Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
results formatting now works better
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesChristie committed Aug 18, 2012
1 parent 4d32e8b commit 3ee3728
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/netsuite-rest-client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def parse_json_result_from_rest(method, params, options={})
end

if !parsed.first || parsed.flatten.include?("UNEXPECTED_ERROR")
raise "Error processing request: #{parsed.last[0].to_s}"
raise "Error processing request: #{parsed.last[0][0].to_s}"
else
parsed.last[0]
end
Expand Down
12 changes: 6 additions & 6 deletions lib/restlets/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ function formatException(exception) {
var serializedException = [exception.name.toString(), exception.message];

try {
return(serializedException.concat([exception.getStackTrace()]));
return(serializedException.concat(exception.getStackTrace()));
}
catch(stack_fetch_error) {
return(serializedException.concat([[stack_fetch_error.message]]));
return(serializedException.concat([stack_fetch_error.message]));
}
}

Expand Down Expand Up @@ -306,10 +306,10 @@ function getHandler(request) {
* Return: JSON response
*/
try {
return([true].concat([[evalOperation('GET', request.operation, request)]]));
return([true].concat([evalOperation('GET', request.operation, request)]));
}
catch(exception) {
return([false].concat([[formatException(exception)]]));
return([false].concat(formatException(exception)));
}
}

Expand All @@ -322,9 +322,9 @@ function postHandler(request) {
* Return: JSON response
*/
try {
return([true].concat([[evalOperation('POST', request['operation'], request)]]));
return([true].concat([evalOperation('POST', request['operation'], request)]));
}
catch(exception) {
return([false].concat([[formatException(exception)]]));
return([false].concat(formatException(exception)));
}
}

0 comments on commit 3ee3728

Please sign in to comment.