Error response

@param string $message
@param mixed $data
@return Response
428200
public function error($message = "", $data = null)
    {
        return $this->response([
            'success' => false,
            'errors' => [
                'message' => $message,
                'status_code' => $this->getStatusCode(),
            ],
            'data' => $data,
        ]);
    }
269426
public function error( $message, $code = null, $data = null )
    {
        if ( null === $code && isset( $this->errorCodes[$message] ) )
        {
            $code = $this->errorCodes[$message];
        }

        return $this->getResponse( 'error', (object) array(
            'code'      => $code,
            'message'   => $message,
            'data'      => $data,
        ) );
    }
1289552
public function success(int $statusCode, string $message, $data = null): JsonResponse
    {

        $this->setStatusCode($statusCode);

        $this->setMessage($message);

        $this->setData($data);


        $content['message'] = $this->getMessage();


        if (null !== $this->getCode()) {
            $content['code'] = $this->getCode();
        }


        $content['status_code'] = $this->getStatusCode();


        if (null !== $this->getData() && $this->getErrors() !== $this->getData()) {
            $content['data'] = $this->getData();
        }

        if (null !== $this->getErrors()) {
            $content['errors'] = $this->getErrors();
        }

        $content += $this->Hypermedia;

        return new JsonResponse($content, $this->getHttpStatusCode() ?: $this->getStatusCode());
    }
215991
public function aError($message,$url='',$data=[])
    {
        $url=is_null($url) || $url=='' ? 'javascript:history.back(-1)' : $url;
        if(Request::isAjax() ){
            return $this->json(1,$message,array_merge($data,['url'=>$url]));
        }else{
            return $this->error($message,$url);
        }
    }
238778
public static HttpResponse errorJSON(@Nonnull String message, @Nonnull Map<?,?> data) {
        return new JSONObjectResponse(data).error(message);
    }
742735
private function throwFatalError($message, $data = [], array $headers = [])
    {
        throw new HttpResponseException($this->fatalErrorResponse($message, $data, $headers));
    }
351408
public function log($message, $data)
    {
        // TODO: Implement log() method.
        $this->logMessages->enqueue([
            'date'    => date('Y-m-d H:i:s'),
            'message' => $message,
            'data'    => $data
        ]);

        return $this;
    }
197306
public static function output($message, $data = null)
    {
        if (static::$mode == "html") {
            static::html($message, $data);
        } else {
            static::text($message, $data);
        }
    }
578371
public function respondInternalError($code = ApiResponse::CODE_API_ERROR, $message = null): JsonResponse
    {
        return $this->setStatusCode(IlluminateResponse::HTTP_INTERNAL_SERVER_ERROR)
            ->respondWithError($code, $message);
    }
1019702
private function errorResponse($message = null)
    {
        if ($message === null)
            $message = 'Unknown error';

        return App::$View->render('editor/load_error', [
            'callbackId' => (int)App::$Request->query->get('CKEditorFuncNum'),
            'message' => $message
        ],__DIR__);
    }
186622
public function validSuccessJsonResponse($message = 'Success', $data = [], $redirect = null)
    {
        return response()->json(
            [
                'code' => '200',
                'message' => $message,
                'data' => $data,
                'errors' => [],
                'redirect' => $redirect,
            ], 200, [], JSON_PRETTY_PRINT
        );
    }
536929
public static function error($message, $context = [], $channel = 'tastphp.logger')
    {
        $logger = static::getLoggerByLevelAndChannel(Monolog::ERROR, $channel);
        $logger->addError($message, $context);
    }
65635
public static function makeError($message, array $data = [])
    {
        $res = [
            'success' => false,
            'message' => $message,
        ];

        if (!empty($data)) {
            $res['data'] = $data;
        }

        return $res;
    }
1271000
public function theResponseIsGraphQLErrorWith(string $message)
    {
        $this->assertResponseStatus(Response::HTTP_OK);

        //success GraphQL response should not contains errors
        if ($this->client->getGraphQL()) {
            if ($this->isValidGraphQLResponse() && $errors = $this->getGraphQLResponseError()) {
                $errorsStack = '';
                foreach ($errors as $error) {
                    $errorsStack .= $error->message."\n";
                }

                Assert::assertContains($message, $errorsStack);
            } else {
                $this->graphQLContext->debugLastQuery();
                throw new AssertionFailedError('The response is not the expected error response.');
            }
        }
    }
1266097
protected function normalizeErrorResponse($content, $data = null)
    {
        if ($content instanceof Arrayable) {
            $content = $content->toArray();
        }

        if ( ! is_array($content)) {
            $content = [
                'message' => $content,
            ];
        }

        if (null !== $data) {
            $content['data'] = $data;
        }

        return $content;
    }
513462
protected function dispatchSentEvent($message, $data = [])
    {
        if ($this->events) {
            $this->events->dispatch(
                new Events\MessageSent($message->getSwiftMessage(), $data)
            );
        }
    }
1189578
public function error($message) {
        $message = printPretty($message, $return=true);

        $hStream = CLI ? \STDERR : fopen('php://stderr', 'a');
        fwrite($hStream, $message);
        if (!CLI) fclose($hStream);
    }