postman-app-support icon indicating copy to clipboard operation
postman-app-support copied to clipboard

Pre-request scripts will not mutate variables if error is thrown

Open dchapman-kla opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the tracker for existing similar issues and I know that duplicates will be closed

Describe the Issue

In a pre-request script, if you throw an error, postman will not set any variables.

Steps To Reproduce

  1. Create a new workspace with an environment and a request.
  2. In the request, navigate to the scripts tab and set the following for a pre-request script:
pm.environment.set("TestVar", "This is a test");

throw new Error("Test");
  1. Run the request.
  2. No variables will have been created / mutated in the associated environment.

Screenshots or Videos

No response

Operating System

Windows

Postman Version

11.10.0

Postman Platform

Postman App

User Account Type

Signed In User

Additional Context?

No response

dchapman-kla avatar Aug 30 '24 19:08 dchapman-kla