Discord web hook responded with an error (429): {"code": 31002, "global": false, "message": "The resource is being rate limited.", "retry_after": 1.425} (500 Internal Server Error)

Symfony Exception

MessageCouldNotBeSent

HTTP 500 Internal Server Error

Discord web hook responded with an error (429): {"code": 31002, "global": false, "message": "The resource is being rate limited.", "retry_after": 1.425}

Exception

MarvinLabs\DiscordLogger\Discord\Exceptions\ MessageCouldNotBeSent

  1.     {
  2.         $response $exception->getResponse();
  3.         $code $response===null $response->getStatusCode();
  4.         $message $response===null '' $response->getBody()->getContents();
  5.         return new static("Discord web hook responded with an error ({$code}): {$message}");
  6.     }
  7.     /** Thrown when the api is not reachable. */
  8.     public static function couldNotCommunicateWithDiscord(Throwable $e): MessageCouldNotBeSent
  9.     {
  1.         {
  2.             $this->http->post($this->url, [$requestType => $payload]);
  3.         }
  4.         catch (ClientException $e)
  5.         {
  6.             throw MessageCouldNotBeSent::serviceRespondedWithAnError($e);
  7.         }
  8.         catch (Exception $e)
  9.         {
  10.             throw MessageCouldNotBeSent::couldNotCommunicateWithDiscord($e);
  11.         }
  1.     public function write(array $record): void
  2.     {
  3.         foreach($this->recordToMessage->buildMessages($record) as $message)
  4.         {
  5.             $this->discord->send($message);
  6.         }
  7.     }
  8.     /** @throws \Illuminate\Contracts\Container\BindingResolutionException */
  9.     protected function createRecordConverter(Container $containerRepository $config): RecordToMessage
  1.             $record $this->processRecord($record);
  2.         }
  3.         $record['formatted'] = $this->getFormatter()->format($record);
  4.         $this->write($record);
  5.         return false === $this->bubble;
  6.     }
  7.     /**
  1.                     }
  2.                 }
  3.                 // once the record exists, send it to all handlers as long as the bubbling chain is not interrupted
  4.                 try {
  5.                     if (true === $handler->handle($record)) {
  6.                         break;
  7.                     }
  8.                 } catch (Throwable $e) {
  9.                     $this->handleException($e$record);
  1.      * @param string|Stringable $message The log message
  2.      * @param mixed[]           $context The log context
  3.      */
  4.     public function error($message, array $context = []): void
  5.     {
  6.         $this->addRecord(static::ERROR, (string) $message$context);
  7.     }
  8.     /**
  9.      * Adds a log record at the CRITICAL level.
  10.      *
  1.      */
  2.     protected function writeLog($level$message$context)
  3.     {
  4.         $this->logger->{$level}(
  5.             $message $this->formatMessage($message),
  6.             $context array_merge($this->context$context)
  7.         );
  8.         $this->fireLogEvent($level$message$context);
  9.     }
  1.      * @param  array  $context
  2.      * @return void
  3.      */
  4.     public function error($message, array $context = [])
  5.     {
  6.         $this->writeLog(__FUNCTION__$message$context);
  7.     }
  8.     /**
  9.      * Log a warning message to the logs.
  10.      *
  1.      * @param  array  $context
  2.      * @return void
  3.      */
  4.     public function error($message, array $context = [])
  5.     {
  6.         $this->driver()->error($message$context);
  7.     }
  8.     /**
  9.      * Exceptional occurrences that are not errors.
  10.      *
  1.         $logger->error(
  2.             $e->getMessage(),
  3.             array_merge(
  4.                 $this->exceptionContext($e),
  5.                 $this->context(),
  6.                 ['exception' => $e]
  7.             )
  8.         );
  9.     }
  10.     /**
  1.     public function handleException(Throwable $e)
  2.     {
  3.         self::$reservedMemory null;
  4.         try {
  5.             $this->getExceptionHandler()->report($e);
  6.         } catch (Exception $e) {
  7.             //
  8.         }
  9.         if ($this->app->runningInConsole()) {
HandleExceptions->handleException()

Stack Trace

MessageCouldNotBeSent
MarvinLabs\DiscordLogger\Discord\Exceptions\MessageCouldNotBeSent:
Discord web hook responded with an error (429): {"code": 31002, "global": false, "message": "The resource is being rate limited.", "retry_after": 1.425}

  at /home/finbold-prod/finbold.com/web/app/themes/finbold/vendor/marvinlabs/laravel-discord-logger/src/DiscordLogger/Discord/Exceptions/MessageCouldNotBeSent.php:18
  at MarvinLabs\DiscordLogger\Discord\Exceptions\MessageCouldNotBeSent::serviceRespondedWithAnError()
     (/home/finbold-prod/finbold.com/web/app/themes/finbold/vendor/marvinlabs/laravel-discord-logger/src/DiscordLogger/Discord/GuzzleWebHook.php:46)
  at MarvinLabs\DiscordLogger\Discord\GuzzleWebHook->send()
     (/home/finbold-prod/finbold.com/web/app/themes/finbold/vendor/marvinlabs/laravel-discord-logger/src/DiscordLogger/LogHandler.php:36)
  at MarvinLabs\DiscordLogger\LogHandler->write()
     (/home/finbold-prod/finbold.com/web/app/themes/finbold/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php:48)
  at Monolog\Handler\AbstractProcessingHandler->handle()
     (/home/finbold-prod/finbold.com/web/app/themes/finbold/vendor/monolog/monolog/src/Monolog/Logger.php:379)
  at Monolog\Logger->addRecord()
     (/home/finbold-prod/finbold.com/web/app/themes/finbold/vendor/monolog/monolog/src/Monolog/Logger.php:626)
  at Monolog\Logger->error()
     (/home/finbold-prod/finbold.com/vendor/illuminate/log/Logger.php:183)
  at Illuminate\Log\Logger->writeLog()
     (/home/finbold-prod/finbold.com/vendor/illuminate/log/Logger.php:94)
  at Illuminate\Log\Logger->error()
     (/home/finbold-prod/finbold.com/vendor/illuminate/log/LogManager.php:590)
  at Illuminate\Log\LogManager->error()
     (/home/finbold-prod/finbold.com/vendor/roots/acorn/src/Illuminate/Foundation/Exceptions/Handler.php:252)
  at Illuminate\Foundation\Exceptions\Handler->report()
     (/home/finbold-prod/finbold.com/vendor/roots/acorn/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:165)
  at Illuminate\Foundation\Bootstrap\HandleExceptions->handleException()