Skip to content

Instantly share code, notes, and snippets.

@joshbirk
Created May 18, 2012 16:25
Show Gist options
  • Select an option

  • Save joshbirk/2726213 to your computer and use it in GitHub Desktop.

Select an option

Save joshbirk/2726213 to your computer and use it in GitHub Desktop.
Apex REST Error Handling
RestResponse res = RestContext.response;
res.addHeader('Error','This is an Error');
res.StatusCode = 400;
return null;
@joshbirk

Copy link
Copy Markdown
Author

And the result would be:
{u'body': u'', u'headers': {'date': 'Fri, 18 May 2012 16:23:04 GMT', 'status': '400', 'content-length': '0', 'server': '', 'error': 'This is an Error'}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment