Skip to content

Commit

Permalink
handle config file not found error
Browse files Browse the repository at this point in the history
  • Loading branch information
sdp5 committed Apr 21, 2023
1 parent 4f67f64 commit 2f04dab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion twcli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_config():
paths.append(custom_config_path)

if not any(os.path.exists(path) for path in paths):
raise click.ClickException('No configuration file was found')
raise click.ClickException('No configuration file was found.')

config.read(paths)
return config
Expand Down
6 changes: 5 additions & 1 deletion twcli/service_layer/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import click
import requests
from twcli.config import get_config, get_config_item
from twcli.constants import TRANSPLATFORM_ENGINES, API_TOKEN_PREFIX, GIT_PLATFORMS
from twcli.service_layer.config.memsource import \
resources as memsource_resources, media_types as memsource_media_types

GITHUB_TOKEN = get_config_item(get_config(), "github", "token")
try:
GITHUB_TOKEN = get_config_item(get_config(), "github", "token")
except click.ClickException as e:
print(f"Warning: {e}\n")


def request_phrase_token(phrase_user: str, phrase_pass: str):
Expand Down

0 comments on commit 2f04dab

Please sign in to comment.