Laravel: The BEST way to handle exceptions

Sdílet
Vložit
  • čas přidán 9. 03. 2023
  • Hi guys!
    In this episode we'll talk about exceptions and how we can make our life easier by utilizing custom exceptions
  • Věda a technologie

Komentáře • 20

  • @julendominadas4040
    @julendominadas4040 Před 19 dny

    i have never worked with any php framework before. Its funny to see that back when i started learning php i designed a request handler that seems pretty similar to this piece of laravel.

  • @JohnSmithhh
    @JohnSmithhh Před 4 měsíci +2

    BEST video on the subject! Thanks for the time saved!

  • @okhaeadeleye2386
    @okhaeadeleye2386 Před 9 měsíci +2

    Thank you. Short and sweet.

  • @grzesiekb9142
    @grzesiekb9142 Před rokem +1

    Dobra robota, człowiek zawsze się czegoś dowie od bardziej doświadczonych ludzi 😊. Zawsze uzywałem try-catch…

  • @zachariascreutznacher3093

    Really like your videos, very good content!

  • @AbderrahmanFodili
    @AbderrahmanFodili Před 4 měsíci

    Amazing stuff. I did sth weird to handle this . I added a helper method that returned an array with the key being the"Exception::class" and the value being either an array or a closure that returns an array as well this array always has a code and a message . this way I managed to also handle Laravel's own exceptions but your way of doing it is the Laravel way through the register method

  • @kareemlateefyomi8690
    @kareemlateefyomi8690 Před rokem

    After registering the custom exception in register method of exception handler, the exception keeps returning the default laravel server error

  • @stefangadjev1310
    @stefangadjev1310 Před rokem +2

    Bro, thats insanely good idea.

  • @gazorbpazorbian
    @gazorbpazorbian Před rokem +1

    this video is really great!

  • @alexz75515
    @alexz75515 Před rokem

    Although I like this way of structuring exceptions, with multiple static returns per class. Clean and short.
    I found few minor caveats:
    - in tests you may need to target exception code or message in addition to class name to assert the exact method thrown.
    - same thing in Laravel exception handler, if you need to target particular static method.

    • @saaslaravel
      @saaslaravel  Před rokem +2

      That's very true. There is a nice solution to it though! Video about it is in the pipeline ;)

    • @youtube-youtube721
      @youtube-youtube721 Před 11 měsíci

      When do you release the video you mentioned above?

    • @saaslaravel
      @saaslaravel  Před 11 měsíci

      ​@@youtube-youtube721next week 😁

  • @thyagobrasileiro3784
    @thyagobrasileiro3784 Před 5 měsíci

    Can you help me, the register function is not been called on Handle.php. I search and i found nothing about. I put a dd but never go there.

  • @MadukaJayalath
    @MadukaJayalath Před rokem +1

    The sound is bit low but great content!

  • @dmitriykret8938
    @dmitriykret8938 Před rokem

    👍

  • @DougLopes
    @DougLopes Před 4 měsíci

    I love your channel and content, but its almost impossible remember your channel name when i want rewatch some video as a brazillian, have you considered rename the channel for something more acessible since your content is global?

    • @abdulsalamamtech
      @abdulsalamamtech Před 4 měsíci

      That's a good notice.
      I also find it difficult to pronoun or type.

  • @NedumEze
    @NedumEze Před rokem +1

    Great idea. But, you didn't consider that some of your audience may not be any where as good as you, and therefore simplify more and slowly.
    Still, thank you very much.
    I may not be able to replicate what you've done!