File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,11 @@ Function getResponse($request : 4D.IncomingMessage) : 4D.OutgoingMessage
2424 $response .setStatus (404 )
2525 End if
2626 Else
27- throw ({code: 9; component: "4DNK"; deferred: True; which: "request (4D.IncomingMessage)"; function: "OAuth2Authorization .getResponse "})
27+ var $error : Object := cs . Tools . me . makeError ( 9 ; { which: "request (4D.IncomingMessage)" ; function: "OAuth2Authorization.getResponse" })
2828
2929 $response .setStatus (500 )
30+ $response .setBody ("Internal Server Error:\r\n\r\n " + JSON Stringify ($error ; * ))
31+ $response .setHeader ("Content-Type" ; "text/plain" )
3032 End if
3133 $response .setHeader ("X-Request-Handler" ; String (OB Class (This ).name ))
3234
Original file line number Diff line number Diff line change @@ -598,4 +598,23 @@ Function urlEncode($value : Text) : Text
598598Function localizedString ($inValue : Text) : Text
599599
600600/* Temp to avoid compilation issues due to command renaming */
601- return Localized string:C991 ($inValue )
601+ return Localized string ($inValue )
602+
603+
604+ // ----------------------------------------------------
605+
606+
607+ Function makeError ($inCode : Integer; $inParameters : Object) : Object
608+
609+ var $description : Text:= cs .Tools .me .localizedString ("ERR_4DNK_" + String ($inCode ))
610+
611+ If (Not (OB Is empty ($inParameters )))
612+ var $key : Text
613+ For each ($key; $inParameters)
614+ $description := Replace string ($description ; "{" + $key + "}" ; String ($inParameters [$key ]))
615+ End for each
616+ End if
617+
618+ var $error : Object:= {errCode: $inCode ; componentSignature: "4DNK" ; message: $description }
619+
620+ return $error
You can’t perform that action at this time.
0 commit comments