Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kattis-command
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Henke
kattis-command
Commits
8d67d3a2
Commit
8d67d3a2
authored
7 years ago
by
Henke Adolfsson
Browse files
Options
Downloads
Patches
Plain Diff
Update exception handling by printing a message
parent
fbfb939b
No related branches found
No related tags found
Loading
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
kattcmd/commands/root.py
+3
-1
3 additions, 1 deletion
kattcmd/commands/root.py
kattcmd/commands/submit.py
+4
-2
4 additions, 2 deletions
kattcmd/commands/submit.py
kattcmd/main.py
+8
-1
8 additions, 1 deletion
kattcmd/main.py
with
15 additions
and
4 deletions
kattcmd/commands/root.py
+
3
−
1
View file @
8d67d3a2
...
...
@@ -4,7 +4,9 @@ import configparser
class
FindRootException
(
Exception
):
pass
def
__init__
(
self
,
message
):
self
.
message
=
message
def
_IsKattisDirectory
(
path
):
...
...
This diff is collapsed.
Click to expand it.
kattcmd/commands/submit.py
+
4
−
2
View file @
8d67d3a2
...
...
@@ -10,7 +10,9 @@ HEADERS = {
}
class
LoginError
(
Exception
):
pass
def
__init__
(
self
,
message
):
self
.
message
=
message
def
_GetFilesWithExtensions
(
bus
,
problemname
,
exts
):
...
...
@@ -28,7 +30,7 @@ def _GetFilesWithExtensions(bus, problemname, exts):
def
_GetUserConfig
(
bus
):
configfile
=
bus
.
call
(
'
kattcmd:config:load-user
'
,
bus
,
'
kattisrc
'
)
if
not
configfile
or
not
os
.
path
.
isfile
(
configfile
):
raise
LoginError
(
'
No .kattisrc file present
'
)
raise
LoginError
(
'
No .kattisrc file present
. Make sure to download it
'
)
config
=
configparser
.
ConfigParser
()
config
.
read
(
configfile
)
return
config
...
...
This diff is collapsed.
Click to expand it.
kattcmd/main.py
+
8
−
1
View file @
8d67d3a2
...
...
@@ -50,4 +50,11 @@ def main():
if
__name__
==
'
__main__
'
:
try
:
main
()
except
Exception
as
e
:
print
(
dir
(
e
))
if
hasattr
(
e
,
'
message
'
):
print
(
e
.
message
)
else
:
print
(
e
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment