public static function throwHttpExceptionWithCode($error_code = null, $payload = [], $hateoas = [], $replacements = [])
    {
        $errors = static::getErrors([$error_code], [$error_code => $payload]);
        $error = current($errors);
        $replacements = self::getReplacements($error['system_message'], $error['payload'], $error['help'], $hateoas, $replacements);
        app('api.exception')->setReplacements($replacements);
        $exception = self::getExceptionObject(static::$errors[$error['error_code']]['exception'], $error);
        throw $exception;
    }
public static function throwHttpExceptionWithCode($error_code = null, $payload = [], $hateoas = [], $replacements = [])
    {
        $errors = static::getErrors([$error_code], [$error_code => $payload]);
        $error = current($errors);
        $replacements = self::getReplacements($error['system_message'], $error['payload'], $error['help'], $hateoas, $replacements);
        app('api.exception')->setReplacements($replacements);
        $exception = self::getExceptionObject(static::$errors[$error['error_code']]['exception'], $error);
        throw $exception;
    }
public static function throwHttpExceptionWithCode ( $ error_code = null , $ payload = [ ] , $ hateoas = [ ] , $ replacements = [ ] ) { $ errors = static :: getErrors ( [ $ error_code ] , [ $ error_code => $ payload ] ) ; $ error = current ( $ errors ) ; $ replacements = self :: getReplacements ( $ error [ 'system_message' ] , $ error [ 'payload' ] , $ error [ 'help' ] , $ hateoas , $ replacements ) ; app ( 'api.exception' ) -> setReplacements ( $ replacements ) ; $ exception = self :: getExceptionObject ( static :: $ errors [ $ error [ 'error_code' ] ] [ 'exception' ] , $ error ) ; throw $ exception ; }
Throw HttpException with specified or unknown error.

@param mixed $error_code   send exception for error with code
@param []    $payload      error description [error code => useful info]
@param array $hateoas      Send here static::getHATEOAS(['%id' => $id, '%placeholder' => 'value']) from generated controller
@param array $replacements additional info inside response
Throw HttpException with specified or unknown error .