[med-svn] [aghermann] 11/31: rk1968: report script runtime error, too

andrei zavada hmmr-guest at alioth.debian.org
Sun Nov 10 00:34:16 UTC 2013


This is an automated email from the git hooks/post-receive script.

hmmr-guest pushed a commit to branch WIP
in repository aghermann.

commit 499d0f35f77587e38df5d748e029d73c2b5a4307
Author: Andrei Zavada <hmmr at ra>
Date:   Sat Nov 9 13:42:32 2013 +0200

    rk1968: report script runtime error, too
---
 upstream/src/aghermann/rk1968/rk1968.cc |    9 +++++++--
 upstream/src/aghermann/rk1968/rk1968.hh |    4 +++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/upstream/src/aghermann/rk1968/rk1968.cc b/upstream/src/aghermann/rk1968/rk1968.cc
index 238973c..9bc3444 100644
--- a/upstream/src/aghermann/rk1968/rk1968.cc
+++ b/upstream/src/aghermann/rk1968/rk1968.cc
@@ -151,8 +151,13 @@ score( agh::SEpisode& E, int* n_pages_scored_p)
         int ret2 = lua_tointeger( lua_state, -1);
         //lua_pop( lua_state, 1);  // zapping stack anyway
 
-        if ( n_pages_scored_p )
-                *n_pages_scored_p = ret2;
+        if ( ret2 >= 0 ) {
+                if ( n_pages_scored_p )
+                        *n_pages_scored_p = ret2;
+        } else {
+                specific_error = agh::str::sasprintf("Script signalled error %d", ret2);
+                return TScoreErrors::script_error;
+        }
 
         return TScoreErrors::ok;
 }
diff --git a/upstream/src/aghermann/rk1968/rk1968.hh b/upstream/src/aghermann/rk1968/rk1968.hh
index f7b9dcd..eb1ae63 100644
--- a/upstream/src/aghermann/rk1968/rk1968.hh
+++ b/upstream/src/aghermann/rk1968/rk1968.hh
@@ -80,7 +80,8 @@ class CScoreAssistant
                 ok,
                 no_script,
                 no_eeg_channels,
-                lua_call_error
+                lua_call_error,
+                script_error,
         };
         static const char*
         score_error_s( TScoreErrors x)
@@ -90,6 +91,7 @@ class CScoreAssistant
                         case TScoreErrors::no_script:                  return "No script compiled";
                         case TScoreErrors::no_eeg_channels:            return "No EEG channels";
                         case TScoreErrors::lua_call_error:             return "Lua script call failed";
+                        case TScoreErrors::script_error:               return "Script signalled error";
                         default:                                       return "(unknown error code)";
                         }
                 }

-- 
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git



More information about the debian-med-commit mailing list