Skip to content

Conversation

@BarbarossaTM
Copy link
Contributor

@BarbarossaTM BarbarossaTM commented Jan 30, 2023

Fixes: #11152

This PR adds a new AbortScript exception which a custom script can throw in case the script should be terminated cleanly. It allows specifying an error message which will be reported to the user, but no stack trace is shown. Any other unhandled exception will still raise a stacktrace.

Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple very minor notes, but this is great work! Thank you!

@jeremystretch
Copy link
Member

@BarbarossaTM thanks for this! Do you think it would make sense to implement this functionality for reports too? (I'd be fine reusing the same AbortScript exception for reports.)

@BarbarossaTM BarbarossaTM force-pushed the 11152-report-script-errors branch from ff2dd4a to 3c92787 Compare February 2, 2023 20:19
@jeremystretch jeremystretch merged commit 699edd0 into netbox-community:develop Feb 2, 2023
@jeremystretch
Copy link
Member

Thanks @BarbarossaTM!

@BarbarossaTM BarbarossaTM deleted the 11152-report-script-errors branch February 2, 2023 20:23
@BarbarossaTM
Copy link
Contributor Author

Thanks for the native speaker language polish :-)

I haven't used report myself yet, but I assume it might be useful there too, I guess the place to do it there would be in

def run_report(job_result, *args, **kwargs):

Do you want to me look into this and file another PR?

@jeremystretch
Copy link
Member

If you'd like to. Or we can wait and see if this gets any feedback first.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow custom scripts to fail gracefully on errors detected by the scripts

2 participants