Errors_ResolveNameByCode(E_UNS_JSONBADINP) ) ); } header("Content-Type: application/json; charset=utf-8"); echo $data; exit; } // Return error as JSON data to stdout and exit function JSON_ReturnError (int $code = -1, string $name = "", string $desc = "") { if ($code === -1 && empty($name)) JSON_ReturnError(code: E_UNS_INTERNAL, desc: "cant return error without specified code or name"); else if ($code === -1) $code = Errors_ResolveCodeByName($name); else if (empty($name)) $name = Errors_ResolveNameByCode($code); JSON_ReturnData(array( "error" => $name, // Name "error_code" => $code, // Code "error_hum" => Errors_ResolveDescByCode($code), // Common description "description" => $desc // Detailed decription )); } ?>