Skip to content

Commit 2f04dab

Browse files
committed
handle config file not found error
1 parent 4f67f64 commit 2f04dab

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

twcli/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_config():
4444
paths.append(custom_config_path)
4545

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

4949
config.read(paths)
5050
return config

twcli/service_layer/decorators.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@
1212
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
1313
# License for the specific language governing permissions and limitations
1414
# under the License.
15+
import click
1516
import requests
1617
from twcli.config import get_config, get_config_item
1718
from twcli.constants import TRANSPLATFORM_ENGINES, API_TOKEN_PREFIX, GIT_PLATFORMS
1819
from twcli.service_layer.config.memsource import \
1920
resources as memsource_resources, media_types as memsource_media_types
2021

21-
GITHUB_TOKEN = get_config_item(get_config(), "github", "token")
22+
try:
23+
GITHUB_TOKEN = get_config_item(get_config(), "github", "token")
24+
except click.ClickException as e:
25+
print(f"Warning: {e}\n")
2226

2327

2428
def request_phrase_token(phrase_user: str, phrase_pass: str):

0 commit comments

Comments
 (0)