Skip to content

Instantly share code, notes, and snippets.

@mmcdaris
Last active November 6, 2020 13:06
Show Gist options
  • Save mmcdaris/17a2ed026e6c33772e8a to your computer and use it in GitHub Desktop.
Save mmcdaris/17a2ed026e6c33772e8a to your computer and use it in GitHub Desktop.
Airbrake example error with curl!

Want to curl an Airbrake test exception?

If you want to curl an error to the Airbrake error capturing service you have come to the right place! This is based off the API doc for create notice. There are more details there ;) https://airbrake.io/docs/#create-notice-v3

Just curl the json with the following command:

curl -X POST -H "Content-Type: application/json" -d @error.json "https://airbrake.io/api/v3/projects/PROJECT_ID/notices?key=PROJECT_KEY"
{
"notifier": {
"name": "curl",
"version": "1.2.3",
"url": "airbrake.io/docs#create-notice-v3"
},
"errors": [
{
"type": "AirbrakeTest",
"message": "Find me at airbrake.io",
"backtrace": [
{
"file": "backtrace file",
"line": 10,
"function": "backtrace function"
}
]
},
{
"type": "error2",
"message": "message2",
"backtrace": [
{
"file": "backtrace file",
"line": 10,
"function": "backtrace function"
}
]
}
],
"context": {
"os": "airbrake-os",
"language": "Ruby 5.5.5",
"environment": "production",
"version": "1.1.1",
"url:": "http://some-site.com/example",
"rootDirectory": "/home/app-root-directory",
"userId": "12345",
"userName": "root",
"userEmail": "[email protected]"
},
"environment": {
"PORT": "443",
"CODE_NAME": "gorilla"
},
"session": {
"basketId": "123",
"userId": "456"
},
"params": {
"page": "555",
"sort": "bacon",
"direction": "desc"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment