GopherCon 2019: Handling Go Errors - Marwan Sulaiman

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ม.ค. 2025

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

  • @ВладимирРудавский-ы2в
    @ВладимирРудавский-ы2в 3 หลายเดือนก่อน +1

    Such a great talk! Exactly the information and examples I was looking for

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

    Very good talk! Lots of great insights and resources for a Go beginner like myself :)

  •  4 ปีที่แล้ว +16

    Writing my own stacktrace mechanism and log category as opposed to have them already included in the language as first class citizens. A dream come true.

  • @morteza4048
    @morteza4048 3 ปีที่แล้ว

    I have used the methodology introduced to me in this talk across multiple languages for years now! Thank you !

  • @blacky101011
    @blacky101011 5 ปีที่แล้ว +9

    At first I kinda got a feeling that he’s inventing syslog, but that stack trace for businesses logic is pretty cool

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

      That's how i feel when writing error handling in go.

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

    Very helpful... Can you share the slides?

  • @JakubArnold
    @JakubArnold 4 ปีที่แล้ว +9

    I don't know if it's just me, but all those "stacktraces are for disasters" reasons seem to me like a bunch of rationalizations, and not choices someone made up front when designing the language.

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

    good video, learnt new things

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

    Good talk.

  • @brister61
    @brister61 5 ปีที่แล้ว +5

    Very useful.

  • @muchzill4
    @muchzill4 2 ปีที่แล้ว

    Awesome talk!

  • @crumblefarmer
    @crumblefarmer 4 ปีที่แล้ว +8

    That poor cameraman... :D

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

      … and viewer.

  • @JonnyPowell
    @JonnyPowell 2 ปีที่แล้ว

    that was a great pun

  • @pss_crs
    @pss_crs 3 ปีที่แล้ว

    Expect me go is my first language

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

    This extreme swinging left and right... very distracting. And the poor camera guy, that has to follow that.

  • @alansargent9715
    @alansargent9715 4 ปีที่แล้ว +25

    Go error handling is so disappointing. Really, hard code names manually, instead of just taking the stack trace and extracting the information because you think it is hard read? The benefit is you're in control of you own stack? Google, if people think their stack isn't good enough why are they all doing it themselves? OMG.

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

      I think it makes sense if it is a support engineer that reads the error message - which is often the case. He understands the application in terms of what it does but perhaps not so much the internals of the code.

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

      You're missing the point. Its about maximising the signal to noise ratio of what you see when an error happens.

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

      @@YoussefTourki I'll have to disagree. After decades of software experience, a stack trace is just noise. The shape isn't unique enough to give you a lot of information. What you want is a high signal to noise ratio.

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

      Stack trace is such a dumb idea for showing errors: "let's just dump everything, something useful must be in there somewhere!". Go is all about clear simplicity - just the thing you need, without the noise. Maybe you'll understand it someday, otherwise, if you enjoy the noise, go is not for you. But you can be sure, that much more thought went into designing this system with this goal in mind, than you put into your assessment.

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

      Sorry didnt wanted to write an article but here it is will try to make a good writing about this somewhere, your comment gave me an idea to write something about
      ​@@florenckaf afaik - each language has its own feature having being provided stack traces in languages like, java, c# made some people used the idea of stack trace being the low effort solution to finding errors.
      make the product work -> error happened -> investigate -> filter noise -> identify -> try fixing -> get paid -> error happened
      when a product goes into maintenance state and is generally reliable and has limited uses
      eg. if your product is being used by a of 100-1000 people and is generally working for them and it is not going to be scaling to seve 100000 people the next year the amount of effort you put into making thing correct is costly if it works for them then it works do not put more effort in fixing shit make new product make more money.
      thus there will be edge cases sometimes and the product will fail and at that time the product team would be like
      "Oh this project -> ah stack trace we will try to figure it out, meanwhile let me reset the database to last backup"
      but people who came from those language to golang, will try to rely on those old habits and when they don't see stack trace but
      [time] ERROR user create failed strconv.atoi: parsing \"1002300o01020\": invalid syntax
      the customer will get 500 internal server error
      the team would be like what happened in user create failed where did this number came from that need to be parsed is this a user id? a foreign key? a user blah blah important info? what is this number that is being parsed in createUser HTTP handler
      how do i reproduce it? how and what is this even
      speaking of which i also heard the same example in a rust vs go talk of some kind where rust will make you handle each edge case
      where an error can occur
      other languages give stack trace dump blah blah blah blah blah blah blah str.conv \"1002300o01020\": invalid syntax
      one would try to deduce the origin of the error or start a debugger and step into each function till get some result
      while go being simple as is a lazy dev will just pass the error back
      the idea here is to add context but other issues to this is when there is too much context and this make you think about the errors but you get to decide how much effort you put the effort into
      while rust make you handle each case or ignore or pass but its is explicitly type errors at each level
      Result or Result
      in go its just error Error() string
      does let you decide do you want to tap into the system error.(UserServiceError) or you want to buuble up the error or slap in some context to the string but not enough to know how to produce this error eg. what is that number that failed parsing when the returned message was
      [time] ERROR user create failed sqlite3 store: strconv.atoi: parsing \"1002300o01020\": invalid syntax
      sure I added more context now that error occurs in sqlite3 store but where in sqlite3 store I have 40 calls in sqlite3 store that is used during createUser
      thus goes the rabbit hole down and down and could also end up looking like a stack trace if I want to exactly know where the error and how It occurred and how to reproduce it.
      thus making people from other lang believe we invented our own stack tracing system
      but how to prevent user private data being leaked into logs.
      If i got audited for my software and got banned due to leaking of user secrets into logs and logs got hacked and etc. etc.
      how much money i am making to put in the effort for the product,
      do abosultly need to handle each and every case and all PnC (enter rust 😅) am i a programmer making the stupidest working product feed myself in this 2024 job market (enter python 😇 )
      Golang -> do i wanna feed myself and be faster then python/javascript but not rich enough to run out of resources to make cleanest leanast program that will bullet proof me and I have fuck ton of time to spend on type masturbation (rust)
      go is flexible enough to let me go on either side or go down in blackhole of no stack trace -> reboot -> data lost your problem not mine i said to copy it in execel sheets everyday and use bank account / printed receipts / file folders to store in real life
      oh my software took down your company (you signed user agreement that i am not responsible for any errors and the software provided is to be used as is) oof my lawyer saved me
      but i already made money off you sue me

  • @Sarah-lh9nd
    @Sarah-lh9nd ปีที่แล้ว

    He's really hot