21
rutee07
38d

Legit question, why does something like this exist?

Has error -> "Error": {"null": false}
No error -> "Error": {"null": true}

I'm just trying to understand the point of this. I had to re-read that many times before posting because even while typing them, I'm already confused. Am I missing something or was this designed for torture?

Comments
  • 1
    Is simple... error has true when error is null

    If error null is not because is error
  • 3
    the only explanation I can think of is that BE uses some kind of framework that does this weird magic... Which means all the consumers of that framework must implement that framework's logic anew.

    if error is not null - the error object is valid. Otherwise, the error is null ("null":true, because I guess either JSON or the framework cannot handle null-keyed maps). Sounds stupid to me :)
  • 1
    Burn them in fire cuz they hold no true value! (or something like that, Hume once said about shit books, now I say about shit code)
  • 0
    Because fuck you and the IDE you rode in on.
  • 1
    What lang/framework is this? Just seems like plain crappy design to me.
  • 2
    what is this framework??
  • 1
    Maybe to test if error is an initialized object?

    Error == null // error doesn’t exist
    Error.null == true // error happened
    Error.null == false // error never happened
  • 1
    Probably to avoid null pointers. You will always have a "valid" Error object
  • 1
    To me it looks like something a junior dev implemented based on a bad explanation from a senior ("if the error is null in the JSON we get from this API than there is no error").
  • 1
    The simplest explanation would be variables of variables...
  • 1
    @AlmondSauce It's from some company in the transportation industry. They are quite the dinosaurs.
  • 1
    @rutee07 Yeah, from that comment, I'm going with "it's just plain crappy design" 😁
  • 1
    @rutee07 uhoh.

    Transportation and dinosaurs... Nah.

    Transportation is right after the big bang...

    I still have nightmares of some discussion....
Add Comment