File: upgrading.md

package info (click to toggle)
php-league-commonmark 2.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,260 kB
  • sloc: php: 20,378; xml: 1,988; ruby: 45; makefile: 21; javascript: 15
file content (24 lines) | stat: -rw-r--r-- 1,203 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
---
layout: default
title: Upgrading from 2.3 to 2.4
description: Guide to upgrading to newer versions of this library
---

# Upgrading from 2.3 to 2.4

## Exception Changes

Prior to 2.4.0, this library did a poor job of using appropriate exception types and documenting which exceptions could
be thrown. For example, all of the main interfaces said that only `RuntimeException` could be thrown, but in reality
other exceptions like `LogicException` or `InvalidArgumentException` could be thrown in some cases!

This inconsistent behavior and inaccurate documentation has been fixed in 2.4.0 by:

- Adding a new `CommonMarkException` interface implemented by all exceptions thrown by this library
- Adding several new exception types that implement that interface while also extending from the same base exception
  type as that would have been previously thrown.
- Fixing incorrect docblocks about the exception types being thrown

If you were previously catching exceptions thrown by this library in your code, you should consider changing your
`catch` blocks to either catch `CommonMarkException` (for all exceptions) or one of the exception types under the
`League\CommonMark\Exception` namespace.