Laravel: The BEST way to handle exceptions

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ย. 2024

ความคิดเห็น • 21

  • @JohnSmithhh
    @JohnSmithhh 8 หลายเดือนก่อน +2

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

  • @grzesiekb9142
    @grzesiekb9142 ปีที่แล้ว +1

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

  • @okhaeadeleye2386
    @okhaeadeleye2386 ปีที่แล้ว +2

    Thank you. Short and sweet.

  • @AbderrahmanFodili
    @AbderrahmanFodili 7 หลายเดือนก่อน

    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

  • @julendominadas4040
    @julendominadas4040 4 หลายเดือนก่อน

    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.

  • @alexz75515
    @alexz75515 ปีที่แล้ว

    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  ปีที่แล้ว +2

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

    • @youtube-youtube721
      @youtube-youtube721 ปีที่แล้ว

      When do you release the video you mentioned above?

    • @saaslaravel
      @saaslaravel  ปีที่แล้ว

      ​@@youtube-youtube721next week 😁

  • @mayurmali9761
    @mayurmali9761 หลายเดือนก่อน

    Does this code handles databse execption or any other execption rather than custom execption?

  • @stefangadjev1310
    @stefangadjev1310 ปีที่แล้ว +2

    Bro, thats insanely good idea.

  • @zachariascreutznacher3093
    @zachariascreutznacher3093 ปีที่แล้ว

    Really like your videos, very good content!

  • @MadukaJayalath
    @MadukaJayalath ปีที่แล้ว +1

    The sound is bit low but great content!

  • @kareemlateefyomi8690
    @kareemlateefyomi8690 ปีที่แล้ว

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

  • @gazorbpazorbian
    @gazorbpazorbian ปีที่แล้ว +1

    this video is really great!

  • @thyagobrasileiro3784
    @thyagobrasileiro3784 9 หลายเดือนก่อน

    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.

  • @DougLopes
    @DougLopes 8 หลายเดือนก่อน

    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 7 หลายเดือนก่อน

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

  • @dmitriykret8938
    @dmitriykret8938 ปีที่แล้ว

    👍

  • @NedumEze
    @NedumEze ปีที่แล้ว +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!