GDBCommandFailedError.st
changeset 88 90c50fd6374c
child 91 472a4841a8b6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GDBCommandFailedError.st	Wed Sep 13 22:11:51 2017 +0100
@@ -0,0 +1,48 @@
+"{ Package: 'jv:libgdbs' }"
+
+"{ NameSpace: Smalltalk }"
+
+GDBError subclass:#GDBCommandFailedError
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'GDB-Core-Exeptions'
+!
+
+!GDBCommandFailedError class methodsFor:'raising'!
+
+raiseForResult: result
+    <resource: #skipInDebuggersWalkBack>
+
+    self newException
+        result: result;
+        raise.
+
+    "Created: / 13-09-2017 / 14:47:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!GDBCommandFailedError methodsFor:'accessing'!
+
+command
+    "Returns the command (as `GDBCommand`) that failed."
+
+    ^ self result command
+
+    "Created: / 13-09-2017 / 14:40:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+result
+    "Returns the command result (as `GDBCommandResult`) for the failure"
+
+    ^ self parameter
+
+    "Created: / 13-09-2017 / 14:41:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+result: aGDBCommandResult
+    parameter := aGDBCommandResult.
+    messageText := 'Command failed: ', (aGDBCommandResult propertyAt: 'msg').
+
+    "Created: / 13-09-2017 / 14:48:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+