Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pykat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
finesse
pykat
Commits
baf85301
Commit
baf85301
authored
10 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
more error handling
parent
c01cd0ad
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pykat/exceptions.py
+1
-1
1 addition, 1 deletion
pykat/exceptions.py
pykat/finesse.py
+48
-38
48 additions, 38 deletions
pykat/finesse.py
with
49 additions
and
39 deletions
pykat/exceptions.py
+
1
−
1
View file @
baf85301
...
@@ -50,6 +50,6 @@ class FinesseRunError(BasePyKatException) :
...
@@ -50,6 +50,6 @@ class FinesseRunError(BasePyKatException) :
self
.
__err
=
err
self
.
__err
=
err
self
.
__kat
=
kat
self
.
__kat
=
kat
BasePyKatException
.
__init__
(
self
,
"
Finesse error (file {1}):
\n
{0}
"
.
format
(
self
.
__err
,
self
.
__kat
)
)
BasePyKatException
.
__init__
(
self
,
self
.
__err
)
#BasePyKatException.__init__(self, "{0}".format(self.__err))
#BasePyKatException.__init__(self, "{0}".format(self.__err))
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
48
−
38
View file @
baf85301
...
@@ -554,6 +554,8 @@ class kat(object):
...
@@ -554,6 +554,8 @@ class kat(object):
Before fully parsing a bunch of commands firstly any constants or variables
Before fully parsing a bunch of commands firstly any constants or variables
to be recorded and replaced.
to be recorded and replaced.
"""
"""
try
:
constants
=
self
.
constants
constants
=
self
.
constants
for
line
in
commands
:
for
line
in
commands
:
...
@@ -602,6 +604,10 @@ class kat(object):
...
@@ -602,6 +604,10 @@ class kat(object):
return
commands_new
return
commands_new
except
pkex
.
BasePyKatException
as
ex
:
pkex
.
PrintError
(
"
Error processing constants:
"
,
ex
)
sys
.
exit
(
1
)
def
parseCommands
(
self
,
commands
,
blocks
=
None
):
def
parseCommands
(
self
,
commands
,
blocks
=
None
):
try
:
try
:
blockComment
=
False
blockComment
=
False
...
@@ -1007,6 +1013,7 @@ class kat(object):
...
@@ -1007,6 +1013,7 @@ class kat(object):
line
=
unicode
(
aline
,
"
utf-8
"
)
line
=
unicode
(
aline
,
"
utf-8
"
)
else
:
else
:
line
=
aline
line
=
aline
if
len
(
line
)
>
0
:
if
len
(
line
)
>
0
:
# remove any ANSI commands
# remove any ANSI commands
#ansi = re.compile(r'\x1b[^m]*m')
#ansi = re.compile(r'\x1b[^m]*m')
...
@@ -1026,12 +1033,14 @@ class kat(object):
...
@@ -1026,12 +1033,14 @@ class kat(object):
sys
.
stdout
.
write
(
"
\r
{0} {1}
"
.
format
(
action
,
prc
))
sys
.
stdout
.
write
(
"
\r
{0} {1}
"
.
format
(
action
,
prc
))
else
:
else
:
sys
.
stdout
.
write
(
"
\r
{0} {1}
"
.
format
(
str
(
action
,
'
utf-8
'
),
str
(
prc
,
'
utf-8
'
)))
sys
.
stdout
.
write
(
"
\r
{0} {1}
"
.
format
(
str
(
action
,
'
utf-8
'
),
str
(
prc
,
'
utf-8
'
)))
elif
line
.
lstrip
().
startswith
(
b
'
*
'
):
elif
line
.
lstrip
().
startswith
(
b
'
*
'
):
if
self
.
verbose
:
if
self
.
verbose
:
if
six
.
PY2
:
if
six
.
PY2
:
sys
.
stdout
.
write
(
line
)
sys
.
stdout
.
write
(
line
)
else
:
else
:
sys
.
stdout
.
write
(
str
(
line
,
'
utf-8
'
))
sys
.
stdout
.
write
(
str
(
line
,
'
utf-8
'
))
elif
line
.
rstrip
().
endswith
(
b
'
%
'
):
elif
line
.
rstrip
().
endswith
(
b
'
%
'
):
vals
=
line
.
split
(
"
-
"
)
vals
=
line
.
split
(
"
-
"
)
action
=
vals
[
0
].
strip
()
action
=
vals
[
0
].
strip
()
...
@@ -1066,8 +1075,7 @@ class kat(object):
...
@@ -1066,8 +1075,7 @@ class kat(object):
# If Finesse returned an error, just print that and exit!
# If Finesse returned an error, just print that and exit!
if
p
.
returncode
!=
0
:
if
p
.
returncode
!=
0
:
print
(
err
)
raise
pkex
.
FinesseRunError
(
err
,
katfile
.
name
)
sys
.
exit
(
1
)
self
.
__prevrunfilename
=
katfile
.
name
self
.
__prevrunfilename
=
katfile
.
name
...
@@ -1140,8 +1148,10 @@ class kat(object):
...
@@ -1140,8 +1148,10 @@ class kat(object):
else
:
else
:
return
r
return
r
except
pkex
.
FinesseRunError
as
fe
:
except
pkex
.
FinesseRunError
as
ex
:
print
(
fe
)
pkex
.
PrintError
(
"
Error from Finesse:
"
,
ex
)
except
pkex
.
BasePyKatException
as
ex
:
pkex
.
PrintError
(
"
Error from pykat:
"
,
ex
)
finally
:
finally
:
if
self
.
verbose
:
print
(
""
)
if
self
.
verbose
:
print
(
""
)
if
self
.
verbose
:
print
(
"
Finished in
"
+
str
(
datetime
.
datetime
.
now
()
-
start
))
if
self
.
verbose
:
print
(
"
Finished in
"
+
str
(
datetime
.
datetime
.
now
()
-
start
))
...
...
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