Skip Navigation
What is your preferred API error response and why?
  • I don't get why the RFC show an example returning 403 with body "You do not have enough credit." although there is a dedicated status code " 402 Payment Required". Isn't more correct to use 402 in this situation?

  • What are some easy-to-solve errors you spent awhile fixing?
  • My top 3 (as mainly JS dev) would be:

    1. Number overflow. It happens when you're backend send big number ID serialized in a JSON. The solution is to wrap the number into a string when you know that can happens.
    JSON.parse('{"n": 123456789123456789012.0}').n
    // => 123456789123456800000
    
    1. Mutating an Object by ref (now I use Object.freeze a lot). Something like:
    const CONFIGURATION = { conf: { enabled: false } }
    // setup a "copy"
    let currentConfiguration = { ...CONFIGURATION }
    currentConfiguration.conf.enabled  = true
    // try to reset the conf
    currentConfiguration = { ...CONFIGURATION }
    // => { conf: { enabled: true } }
    
    1. Assignation instead of comparison (now my IDE warn me)
    if (foo = false) {
      // do something
    }
    
  • Help with LineageOS
  • I'm in the same situation. I have a One Plus 8, and when I try to update using the updater app on Android, my phone reboot a dozen of time but finally boot without updating Lineage OS. I tried twice and finally gave up...

  • Deno's Standard Library for JavaScript Finally Stabilized at v1 | 3min 5sec Video | Aug 8, 2024
  • The video mentions some "de facto" standard libraries like Lodash or Underscore. But there is also Bun which try to promote their standard library like their test runner, their HTTP server, etc..

    I like Deno's approach, since they try to make their “Standard library” also available for other platform. But only few of them are compatible with Node.js.

    For instance, @std/cli is only available for Deno. So I'll stick with commander which is more standard for CLI tools, and it works with Deno, Bun & Node.js.

  • How to get started with pirating music (mp3s)?
  • my two cents,

    I personally buy some music from Bandcamp, and I'm pretty sure those songs don't exist on the Apple Music catalog. So I don't want to handle multiple apps to listen what I want.

    Also, streaming platforms have the internet constraints. Sometimes, like when I'm driving, I don't have a stable internet connection

  • InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)MA
    madeindjs @programming.dev
    Posts 0
    Comments 29