RPTools / maptool

Virtual Tabletop for playing roleplaying games with remote players or face to face.
http://rptools.net
GNU Affero General Public License v3.0
787 stars 259 forks source link

Return JSON on rest failure to mtscript instead of exception #4896

Closed Jmr3366 closed 2 weeks ago

Jmr3366 commented 3 weeks ago

Identify the Bug or Feature request

closes #2489

Description of the Change

rest failures will now return a JSON in the format below {"error": < message or code >}

Examples: [r: rest.get("https:\\errorTest")] output {"error":java.net.UnknownHostException: No such host is known (errorTest)"}

Deny example: [r: rest.get("https:\\knownGoodURL")] output {"error": "403"}


This change is Reviewable

Jmr3366 commented 3 weeks ago

fwiw I didn't see a way for me to label the PR, I'm guessing github is having issues pulling in the #data info.