`json_decode` does not throw any exception. You should detect if the return `$data` is `null` and use [`json_last_error`](http://www.php.net/manual/en/function.json-last-error.php) in the `InvalidArgumentException`.