• lime!@feddit.nu
    link
    fedilink
    English
    arrow-up
    89
    arrow-down
    1
    ·
    13 days ago

    how tf would a missing semicolon result in a http server error

    • stinky@redlemmy.com
      link
      fedilink
      English
      arrow-up
      65
      ·
      13 days ago

      In ASP.NET applications, specifically in ASP.NET Web Forms and ASP.NET MVC (pre-Core), the compilation process is dynamic and happens at runtime if source files like .cshtml, .aspx, and .cs files are present on the server.

      ASP.NET uses just-in-time (JIT) compilation for views (.cshtml, .aspx, .ascx, etc.) and sometimes for code-behind files (.cs). When a request hits a page, ASP.NET dynamically compiles these files into temporary assemblies.

      If there’s a syntax error, missing semicolon, incorrect type, or any other compilation issue, the process will fail and throw a 500 error.

      • lime!@feddit.nu
        link
        fedilink
        English
        arrow-up
        13
        ·
        12 days ago

        why would you use asp in an introductory course

        even if you have like a student learning platform so they don’t have to install anything, surely it would wrap the code that’s submitted so it doesn’t crash the application

        • stinky@redlemmy.com
          link
          fedilink
          English
          arrow-up
          12
          ·
          12 days ago

          my guess is he had all the boilerplate written, and was using a single line or two of “working code” to show what the technology was capable of

          but it’s 4chan greentext so it could be fake and gay

      • lime!@feddit.nu
        link
        fedilink
        English
        arrow-up
        1
        ·
        12 days ago

        if your server runs user-submitted code server side, that’s a paddlin

        • Black616Angel@discuss.tchncs.de
          link
          fedilink
          arrow-up
          3
          ·
          12 days ago

          It never said user code.

          This could as well be an intro to php and the server may be set to not show errors and instead just fail.

          The lecturer then writes some code, forgets a semicolon and gets a 500.

      • Echo Dot@feddit.uk
        link
        fedilink
        arrow-up
        1
        arrow-down
        2
        ·
        12 days ago

        If the file failed to compile the server wouldn’t execute it because a file wouldn’t be created. A compile error stops the process, It doesn’t result in a corrupted output, since that would be really stupid.

        • taladar@sh.itjust.works
          link
          fedilink
          arrow-up
          11
          ·
          12 days ago

          For the same reason our OS memory management class was in Java, a language without pointers, because some idiot decided all courses had to be standardized on the same language because the industry says they need people who know that language now.

  • Echo Dot@feddit.uk
    link
    fedilink
    arrow-up
    66
    arrow-down
    3
    ·
    edit-2
    12 days ago

    What programming language returns a 500 error because it fails?

    A 500 error code is a critical server failure, It isn’t something that can happen because a piece of JavaScript failed.

    • KubeRoot@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      38
      ·
      12 days ago

      Maybe PHP? Since it runs as a server and returns computed results in a browser… Though I’m pretty sure it’d just return the compiler error text

      • Echo Dot@feddit.uk
        link
        fedilink
        arrow-up
        13
        arrow-down
        2
        ·
        12 days ago

        Php outputs HTML at the end of the process. If it didn’t run because of a missing semicolon it would just output an error. It wouldn’t crash

        • lurch (he/him)@sh.itjust.works
          link
          fedilink
          arrow-up
          5
          ·
          11 days ago

          this is not always true. many tutorials encourage people to do a setup that does not output a PHP error to the web, as it can leak info that may help an attacker, such as the file path the error occurred in. in setups like these PHP will log the error to a file an attacker can’t access (often /var/log/php/error.log ) and exit with a failure status code, which many common web server setups will turn into an HTTP 500 error. Some server setups will just send an empty file though, which will be a blank white page shown in a browser.

    • merc@sh.itjust.works
      link
      fedilink
      arrow-up
      17
      ·
      12 days ago

      Any programming language that runs on the web server and doesn’t gracefully handle its errors. There are many web servers implemented in Javascript, but it could also be Java, it could be Perl, it could even be C/C++ if someone is being masochistic.

    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      13
      ·
      11 days ago

      Javascript also exists on the server, and an exception would cause a 500 error. Semicolons are optional in JavaScript, except for a handful of cases. One of those is in a for loop. I’m guessing the professor was running a nodejs app and did something like this (intentionally bad style because professor):

      for (x = 0; x < 5 x++)
      {} 
      return x
      

      Boom, syntax error, which would return a 500 air status in a nodejs web server framework.

    • ඞmir@lemmy.ml
      link
      fedilink
      arrow-up
      12
      ·
      12 days ago

      Old IIS versions with PHP would do this when running in production mode. Talking about 2010-2012

  • BatrickPateman@lemmy.world
    link
    fedilink
    arrow-up
    28
    ·
    12 days ago

    Intro to IT on some webform stuff is truly the darkest timeline.

    Where have the good old times gone when peeps were tortured with plain C in some atrocious outdated IDE from the ancient times?!