-
Notifications
You must be signed in to change notification settings - Fork 1
_api error handling
Chris Lowth edited this page Sep 21, 2022
·
3 revisions
Errors returned by Turbonomic in response to API requests made by the tool result in exceptions being thrown by the client
API functions. You can catch these using JavaScript's try/catch syntax. You can also obtain details of the error body (if it was in a JSON format) using client.lastException()
. This typically returns an object with two or three fields (type [integer], exception [string] and optionally: message [string]).
try {
var opts = {
q: "",
types: args[0]
}
var rtn = client.getSearchResults(opts)
} catch (err) {
eprintln("ERROR : "+err);
eprintln(client.lastException().message)
}
NB: This WIKI is a work in progress and is known to be incomplete and inaccurate in places as it stands.
Starting points
Popular pages