Handling Errors

A review of some basic error handling when dealing with error responses.

When running a Postman collection, you may run across errors. For this example, we see a 401 is thrown when we try to run our collection (As seen in the screen shot below).

1920

To solve these issues, Postman has a console that makes it easier to debug these issues.

Step 1

1920 1920

Our first step will be to open the postman console, by opening the View menu and selecting Show Postman Console... as seen in the above screenshots.

986

This will open up a separate window for the console. However when first opened, the console will be empty of any information, as it needs to be open first before running
any scripts or collections.

Step 2

1920

Next we will navigate back to our collection and click Retry to run the collection and recreate the error.

Step 3

Once the error has been recreated, we then want to look into our Postman Console window to debug.

986

For this error, we opened up the first POST call to see the following response body:

{"error":"invalid_grant","error_description":"Invalid user credentials"}

This would lead us to check our environment variables to make sure the user credentials are accurate.

Step 4

The above steps can be repeated as necessary to solve many environment variable, script, or collection errors that may occur.