FlatLang / Flat

(Deprecated) Soon-to-be legacy Flat compiler all in one
6 stars 0 forks source link

Multiple catches does not work correctly in js #431

Open BSteffaniak opened 2 years ago

BSteffaniak commented 2 years ago
try {
  if (args.count < 2) {
    throw Exception("Missing command")
  }

  Airship(args.skip(1)):run()
} catch (FlatInstallationFailureException e) {
  log.error(e.message)
  System.exit(1)
} catch (Exception e) {
  log.error(e.message)
  external {
    console.error(#{e}.error);
  }
  System.exit(1)
}

produces:

try {
    if (args.accessor_count() < 2) {
        throw Exception.construct(FlatString.construct4("Missing command"));
    }
    (await Airship.construct2(args.skip(1)).__chainAsync('run', []));
} catch (e)  {
    if (!(e instanceof Exception)) {
        console.log(0.9890224985166168);
        console.error(e);
        process.exit(1);
    } else {
        Airship.log.error(e.message);
        System.exit0(1);
    }
    }
catch (e)  {
    if (!(e instanceof Exception)) {
        console.log(0.3028649297462579);
        console.error(e);
        process.exit(1);
    } else {
        Airship.log.error(e.message);
        console.error(e.error);
        System.exit0(1);
    }
    }
finally {
}