You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say I have a Request but I only want that being run on a specific condition.
In general, I can just write throw new Error("cause of the error"); and thats it.
In my case I would like to use console.log() or console.info() before throwing an error but because of the throw new the console message is not displayed.
Describe the solution you'd like
Would it be possible to use return false; and still logging to console?
Currently the script return false; results the following:
When I would use return false I would expect that the Request is not being made at all.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Thanks for the feedback. I will support printing logs when an error is thrown in the pre-request script. I'm not certain about using 'return false' because I think throwing an error is more obvious and solves the problem, especially if logs will be printed. By the way, you can run requests conditionally in the Test script of a Folder or Test Suite, like this:
if (condition) {
await jc.runRequest("1d4246e1");
}
Thanks for the support!
Well, regarding the return statement, I'm not really sure either.
Actually in the Pre-Request tab, I would like to do some precondition checking and if that fails, I would like to prevent the "normal" requuest being fired. With the console object, I'd like to provide additional info(), warn() or even error() message. In such case, throwing an error seems a bit too harsh for me but I can live with it. But for me its more important to structure the messages in the console which Error(msg) is not capable of.
Is your feature request related to a problem?
Let's say I have a Request but I only want that being run on a specific condition.
In general, I can just write
throw new Error("cause of the error");
and thats it.In my case I would like to use
console.log()
orconsole.info()
before throwing an error but because of thethrow new
the console message is not displayed.Describe the solution you'd like
Would it be possible to use
return false;
and still logging to console?Currently the script
return false;
results the following:When I would use
return false
I would expect that the Request is not being made at all.Additional context
No response
The text was updated successfully, but these errors were encountered: