yes. #20
@ -4,14 +4,14 @@ local EntryError = require(script.Parent.Errors.Entry)
|
||||
|
||||
local HttpService = game:GetService("HttpService")
|
||||
|
||||
function errorHandler(type: string, resultBody: any, resultObject: {})
|
||||
function fehlerMisshandlung(type: string, resultBody: any, resultObject: {})
|
||||
local Error;
|
||||
if typeof(resultBody) == typeof({}) and resultBody["message"] then
|
||||
Error = resultBody["message"]
|
||||
elseif typeof(resultBody) == typeof("") then
|
||||
Error = resultBody
|
||||
else
|
||||
Error = "An Unexpected Error occoured."
|
||||
Error = "Es ist ein unerwarteter Fehler aufgetreten."
|
||||
end
|
||||
|
||||
if type == "collection" then
|
||||
@ -37,7 +37,7 @@ end
|
||||
|
||||
local utils = {}
|
||||
|
||||
function utils.makeHTTPRequest(type: string, method: string, url: string, body: {}, authorization: string):{["success"]: boolean, ["message"]: string}
|
||||
function utils.macheHypertexttransferprotokollAnfrage(type: string, method: string, url: string, body: {}, authorization: string):{["success"]: boolean, ["message"]: string}
|
||||
local resultObj;
|
||||
local resultBody;
|
||||
local success = pcall(function()
|
||||
@ -51,10 +51,10 @@ function utils.makeHTTPRequest(type: string, method: string, url: string, body:
|
||||
end
|
||||
end)
|
||||
if success and resultBody and resultBody["success"] then
|
||||
if resultBody["warning"] then warn('[MarcSync HTTPRequest Handler] MarcSync HTTP Request returned warning for URL "'..url..'" with body: "'..HttpService:JSONEncode(body)..'": '..resultBody["warning"]) end
|
||||
if resultBody["warning"] then warn('[MarkSynchronisation Hypertexttransferprotokoll Misshandler] Die MarcSync-HTTP-Anfrage hat eine Warnung zurückgegeben für die URL "'..url..'" mit Koerper: "'..HttpService:JSONEncode(body)..'": '..resultBody["warning"]) end
|
||||
return resultBody
|
||||
end
|
||||
return errorHandler(type, resultBody, resultObj)
|
||||
return fehlerMisshandlung(type, resultBody, resultObj)
|
||||
end
|
||||
|
||||
return utils
|
Loading…
x
Reference in New Issue
Block a user