File tree Expand file tree Collapse file tree
user_guide_src/source/general Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ Catching Specific Exceptions
4141^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4242
4343In the example above, we catch any type of Exception. If we only want to watch for specific types of exceptions, like
44- a ``UnknownFileException ``, we can specify that in the catch parameter. Any other exceptions that are thrown and are
44+ a ``DataException ``, we can specify that in the catch parameter. Any other exceptions that are thrown and are
4545not child classes of the caught exception will be passed on to the error handler:
4646
4747.. literalinclude :: errors/003.php
Original file line number Diff line number Diff line change 11<?php
22
3+ use CodeIgniter \Database \Exceptions \DataException ;
4+
35try {
46 $ user = $ userModel ->find ($ id );
5- } catch (\ CodeIgniter \ UnknownFileException $ e ) {
7+ } catch (DataException $ e ) {
68 // do something here...
79}
Original file line number Diff line number Diff line change 11<?php
22
3+ use CodeIgniter \Database \Exceptions \DataException ;
4+
35try {
46 $ user = $ userModel ->find ($ id );
5- } catch (\ CodeIgniter \ UnknownFileException $ e ) {
7+ } catch (DataException $ e ) {
68 // do something here...
79
810 throw new \RuntimeException ($ e ->getMessage (), $ e ->getCode (), $ e );
You can’t perform that action at this time.
0 commit comments