Skip to content

Commit bb448f1

Browse files
committed
Adds support for obtaining exception details; fixes #97
1 parent fdef01b commit bb448f1

File tree

3 files changed

+148
-3
lines changed

3 files changed

+148
-3
lines changed

debugProtocol.json

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,65 @@
17851785
}]
17861786
},
17871787

1788+
"ExceptionInfoRequest": {
1789+
"allOf": [ { "$ref": "#/definitions/Request" }, {
1790+
"type": "object",
1791+
"description": "ExceptionInfoRequest request; value of command field is 'exceptionInfo'.\nRetrieves the details of the exception that caused the StoppedEvent to be raised.",
1792+
"properties": {
1793+
"command": {
1794+
"type": "string",
1795+
"enum": [ "completions" ]
1796+
},
1797+
"arguments": {
1798+
"$ref": "#/definitions/CompletionsArguments"
1799+
}
1800+
},
1801+
"required": [ "command", "arguments" ]
1802+
}]
1803+
},
1804+
"ExceptionInfoArguments": {
1805+
"type": "object",
1806+
"description": "Arguments for 'exceptionInfo' request.",
1807+
"properties": {
1808+
"threadId": {
1809+
"type": "integer",
1810+
"description": "Thread for which exception information should be retrieved."
1811+
}
1812+
},
1813+
"required": [ "threadId" ]
1814+
},
1815+
"ExceptionInfoResponse": {
1816+
"allOf": [ { "$ref": "#/definitions/Response" }, {
1817+
"type": "object",
1818+
"description": "Response to 'exceptionInfo' request.",
1819+
"properties": {
1820+
"body": {
1821+
"type": "object",
1822+
"properties": {
1823+
"exceptionId": {
1824+
"type": "string",
1825+
"description": "ID of the exception that was thrown."
1826+
},
1827+
"description": {
1828+
"type": "string",
1829+
"description": "Descriptive text for the exception provided by the debug adapter."
1830+
},
1831+
"breakMode": {
1832+
"$ref": "#/definitions/ExceptionBreakMode",
1833+
"description": "Mode that caused the exception notification to be raised."
1834+
},
1835+
"details": {
1836+
"$ref": "#/definitions/ExceptionDetails",
1837+
"description": "Detailed information about the exception."
1838+
}
1839+
},
1840+
"required": [ "exceptionId", "breakMode" ]
1841+
}
1842+
},
1843+
"required": [ "body" ]
1844+
}]
1845+
},
1846+
17881847
"Capabilities": {
17891848
"type": "object",
17901849
"description": "Information about the capabilities of a debug adapter.",
@@ -1869,6 +1928,10 @@
18691928
"supportsValueFormattingOptions": {
18701929
"type": "boolean",
18711930
"description": "The debug adapter supports a 'format' attribute on the stackTraceRequest, variablesRequest, and evaluateRequest."
1931+
},
1932+
"supportsExceptionInfoRequest": {
1933+
"type": "boolean",
1934+
"description": "The debug adapter supports the exceptionInfo request."
18721935
}
18731936
}
18741937
},
@@ -2481,6 +2544,41 @@
24812544
}
24822545
},
24832546
"required": [ "names" ]
2547+
},
2548+
2549+
"ExceptionDetails": {
2550+
"type": "object",
2551+
"description": "Detailed information about an exception that has occurred.",
2552+
"properties": {
2553+
"message": {
2554+
"type": "string",
2555+
"description": "Message contained in the exception."
2556+
},
2557+
"typeName": {
2558+
"type": "string",
2559+
"description": "Short type name of the exception object."
2560+
},
2561+
"fullTypeName": {
2562+
"type": "string",
2563+
"description": "Fully-qualified type name of the exception object."
2564+
},
2565+
"evaluateName": {
2566+
"type": "string",
2567+
"description": "Optional expression that can be evaluated in the current scope to obtain the exception object."
2568+
},
2569+
"stackTrace": {
2570+
"type": "string",
2571+
"description": "Stack trace at the time the exception was thrown."
2572+
},
2573+
"innerException": {
2574+
"type": "array",
2575+
"items": {
2576+
"$ref": "#/definitions/ExceptionDetails"
2577+
},
2578+
"description": "Details of the exception contained by this exception, if any."
2579+
}
2580+
}
24842581
}
2582+
24852583
}
24862584
}

protocol/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This npm module contains declarations for the json-based Visual Studio Code debu
99

1010
* 1.17.x:
1111
* Adds optional attribute `clientID` to the `InitializeRequestArguments`.
12+
* Adds support for obtaining exception details: `ExceptionInfoRequest`, `ExceptionDetails`.
1213

1314
* 1.16.x:
1415
* Updated comments for `path` and `sourceReference` attributes of `Source` type (the frontend no longer needs to have a notion of 'internal' modules; it just loads the content of a Source either through the sourceReference or the path).

protocol/src/debugProtocol.ts

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,34 @@ export module DebugProtocol {
907907
};
908908
}
909909

910+
/** ExceptionInfoRequest request; value of command field is 'exceptionInfo'.
911+
Retrieves the details of the exception that caused the StoppedEvent to be raised.
912+
*/
913+
export interface ExceptionInfoRequest extends Request {
914+
// command: 'completions';
915+
arguments: ExceptionInfoArguments;
916+
}
917+
918+
/** Arguments for 'exceptionInfo' request. */
919+
export interface ExceptionInfoArguments {
920+
/** Thread for which exception information should be retrieved. */
921+
threadId: number;
922+
}
923+
924+
/** Response to 'exceptionInfo' request. */
925+
export interface ExceptionInfoResponse extends Response {
926+
body: {
927+
/** ID of the exception that was thrown. */
928+
exceptionId: string;
929+
/** Descriptive text for the exception provided by the debug adapter. */
930+
description?: string;
931+
/** Mode that caused the exception notification to be raised. */
932+
breakMode: ExceptionBreakMode;
933+
/** Detailed information about the exception. */
934+
details?: ExceptionDetails;
935+
};
936+
}
937+
910938
/** Information about the capabilities of a debug adapter. */
911939
export interface Capabilities {
912940
/** The debug adapter supports the configurationDoneRequest. */
@@ -945,6 +973,8 @@ export module DebugProtocol {
945973
supportsExceptionOptions?: boolean;
946974
/** The debug adapter supports a 'format' attribute on the stackTraceRequest, variablesRequest, and evaluateRequest. */
947975
supportsValueFormattingOptions?: boolean;
976+
/** The debug adapter supports the exceptionInfo request. */
977+
supportsExceptionInfoRequest?: boolean;
948978
}
949979

950980
/** An ExceptionBreakpointsFilter is shown in the UI as an option for configuring how exceptions are dealt with. */
@@ -980,9 +1010,9 @@ export module DebugProtocol {
9801010
/** A Module object represents a row in the modules view.
9811011
Two attributes are mandatory: an id identifies a module in the modules view and is used in a ModuleEvent for identifying a module for adding, updating or deleting.
9821012
The name is used to minimally render the module in the UI.
983-
1013+
9841014
Additional attributes can be added to the module. They will show up in the module View if they have a corresponding ColumnDescriptor.
985-
1015+
9861016
To avoid an unnecessary proliferation of additional attributes with similar semantics but different names
9871017
we recommend to re-use attributes from the 'recommended' list below first, and only introduce new attributes if nothing appropriate could be found.
9881018
*/
@@ -993,7 +1023,7 @@ export module DebugProtocol {
9931023
name: string;
9941024
/** optional but recommended attributes.
9951025
always try to use these first before introducing additional attributes.
996-
1026+
9971027
Logical full path to the module. The exact definition is implementation defined, but usually this would be a full path to the on-disk file for the module.
9981028
*/
9991029
path?: string;
@@ -1285,5 +1315,21 @@ export module DebugProtocol {
12851315
/** Depending on the value of 'negate' the names that should match or not match. */
12861316
names: string[];
12871317
}
1318+
1319+
/** Detailed information about an exception that has occurred. */
1320+
export interface ExceptionDetails {
1321+
/** Message contained in the exception. */
1322+
message?: string;
1323+
/** Short type name of the exception object. */
1324+
typeName?: string;
1325+
/** Fully-qualified type name of the exception object. */
1326+
fullTypeName?: string;
1327+
/** Optional expression that can be evaluated in the current scope to obtain the exception object. */
1328+
evaluateName?: string;
1329+
/** Stack trace at the time the exception was thrown. */
1330+
stackTrace?: string;
1331+
/** Details of the exception contained by this exception, if any. */
1332+
innerException?: ExceptionDetails[];
1333+
}
12881334
}
12891335

0 commit comments

Comments
 (0)