Skip to content

Commit

Permalink
Merge pull request #207
Browse files Browse the repository at this point in the history
dev
  • Loading branch information
leonardosahon authored Nov 24, 2024
2 parents 2c52af4 + 2b45590 commit 2711c3b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Core/Api/ApiEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final class ApiEngine {
private static self $engine;
private static bool $DEBUG_MODE = false;
private static bool $DEBUG_DUMP_MODE = false;
private static bool $ERRORS_AS_JSON = true;

private const RATE_LIMIT_CACHE_FILE = 'rate_limiter/';

Expand Down Expand Up @@ -195,7 +196,7 @@ private static function exception(
$stack_trace,
exception: $exception,
throw_500: $header['throw_header'],
error_as_json: true,
error_as_json: self::$ERRORS_AS_JSON,
json: [
"code" => $header['code'],
"message" => $header['msg'],
Expand Down Expand Up @@ -1158,6 +1159,12 @@ public static function fetch(string $local_endpoint = "api") : self {
return self::$engine;
}

public static function display_error_as_html() : void
{
if(LayConfig::$ENV_IS_DEV)
self::$ERRORS_AS_JSON = false;
}

public static function end(bool $print_existing_result = true) : ?string {
$uri = self::$request_uri_raw ?? "";

Expand Down

0 comments on commit 2711c3b

Please sign in to comment.