Skip to content

Latest commit

 

History

History
60 lines (38 loc) · 836 Bytes

File metadata and controls

60 lines (38 loc) · 836 Bytes

1.x to 2.x

Adapted error handling.

Added:

  • Chubbyphp\Parsing\Errors
  • Chubbyphp\Parsing\ErrorsException

Removed:

  • Chubbyphp\Parsing\ParserErrorException
  • Chubbyphp\Parsing\ParserErrorExceptionToString

old:

<?php

declare(strict_types=1);

namespace App;

use Chubbyphp\Parsing\Parser;
use Chubbyphp\Parsing\ParserErrorException;

$p = new Parser();

$schema = $p->string();

try {
    $schema->parse('test');
} catch (ParserErrorException $e)  {
    var_dump($e->getApiProblemErrorMessages());
}

new

<?php

declare(strict_types=1);

namespace App;

use Chubbyphp\Parsing\ErrorsException;
use Chubbyphp\Parsing\Parser;

$p = new Parser();

$schema = $p->string();

try {
    $schema->parse('test');
} catch (ErrorsException $e)  {
    var_dump($e->errors->toApiProblemInvalidParameters());
}