This reduces the text output when an error is hit, removing the tracebacks for known errors. Tracebacks are for unknown/unexpected errors - if you expect an error, it's better to print out an actual error message. I've also made the patch applying a bit more verbose in case it helps, as it sometimes does.

Example after the changes:

```
Building the following packages: yt
[1/1] (thread 1) building yt
Error building yt. Printing build logs.
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git a/setupext.py b/setupext.py
|index 92c456bab..ce2c5fbad 100644
|--- a/setupext.py
|+++ b/setupext.py
--------------------------
patching file setupext.py
Using Plan A...
Hunk #1 FAILED at 57.
1 out of 1 hunk FAILED -- saving rejects to file setupext.py.rej
done
[2022-03-02 17:35:58] Building package yt...
ERROR: Patch /src/packages/yt/patches/skip-openmp.patch failed
[2022-03-02 17:36:14] Succeeded building package yt in 16.5 seconds.
ERROR: cancelling buildall
[1/1] (thread 1) failed yt in 16.76 s
make[1]: *** [Makefile:12: all] Error 1
make[1]: Leaving directory '/src/packages'
make: *** [Makefile:187: build/packages.json] Error 2
```

fix: better error messages, fewer tracebacks. This reduces the text output when an error is hit, removing the tracebacks for known errors. Tracebacks are for unknown/unexpected errors - if you expect an error, it's better to print out an actual error message. I've also made the patch applying a bit more verbose in case it helps, as it sometimes does.

Example after the changes:

```
Building the following packages: yt
[1/1] (thread 1) building yt
Error building yt. Printing build logs.
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git a/setupext.py b/setupext.py
|index 92c456bab..ce2c5fbad 100644
|--- a/setupext.py
|+++ b/setupext.py
--------------------------
patching file setupext.py
Using Plan A...
Hunk #1 FAILED at 57.
1 out of 1 hunk FAILED -- saving rejects to file setupext.py.rej
done
[2022-03-02 17:35:58] Building package yt...
ERROR: Patch /src/packages/yt/patches/skip-openmp.patch failed
[2022-03-02 17:36:14] Succeeded building package yt in 16.5 seconds.
ERROR: cancelling buildall
[1/1] (thread 1) failed yt in 16.76 s
make[1]: *** [Makefile:12: all] Error 1
make[1]: Leaving directory '/src/packages'
make: *** [Makefile:187: build/packages.json] Error 2
```

/**
 * The Emscripten Module.
 *
 * @private
 */
export let Module: any = {};
Module.noImageDecoding = true;
Module.noAudioDecoding = true;
Module.noWasmDecoding = false; // we preload wasm using the built in plugin now
Module.preloadedWasm = {};
Module.preRun = [];

export let API: any = {};
Module.API = API;
export let Hiwire: any = {};
Module.hiwire = Hiwire;

// Put things that are exposed only for testing purposes here.
export let Tests: any = {};
API.tests = Tests;

/**
 *
 * @param stdin
 * @param stdout
 * @param stderr
 * @private
 */
export function setStandardStreams(
  stdin?: () => string,
  stdout?: (a: string) => void,
  stderr?: (a: string) => void
) {
  // For stdout and stderr, emscripten provides convenient wrappers that save us the trouble of converting the bytes into a string
  if (stdout) {
    Module.print = stdout;
  }

  if (stderr) {
    Module.printErr = stderr;
  }

  // For stdin, we have to deal with the low level API ourselves
  if (stdin) {
    Module.preRun.push(function () {
      Module.FS.init(createStdinWrapper(stdin), null, null);
    });
  }
}

function createStdinWrapper(stdin: () => string) {
  // When called, it asks the user for one whole line of input (stdin)
  // Then, it passes the individual bytes of the input to emscripten, one after another.
  // And finally, it terminates it with null.
  const encoder = new TextEncoder();
  let input = new Uint8Array(0);
  let inputIndex = -1; // -1 means that we just returned null
  function stdinWrapper() {
    try {
      if (inputIndex === -1) {
        let text = stdin();
        if (text === undefined || text === null) {
          return null;
        }
        if (typeof text !== "string") {
          throw new TypeError(
            `Expected stdin to return string, null, or undefined, got type ${typeof text}.`
          );
        }
        if (!text.endsWith("\n")) {
          text += "\n";
        }
        input = encoder.encode(text);
        inputIndex = 0;
      }

      if (inputIndex < input.length) {
        let character = input[inputIndex];
        inputIndex++;
        return character;
      } else {
        inputIndex = -1;
        return null;
      }
    } catch (e) {
      // emscripten will catch this and set an IOError which is unhelpful for
      // debugging.
      console.error("Error thrown in stdin:");
      console.error(e);
      throw e;
    }
  }
  return stdinWrapper;
}

/**
 * Make the home directory inside the virtual file system,
 * then change the working directory to it.
 *
 * @param path
 * @private
 */
export function setHomeDirectory(path: string) {
  Module.preRun.push(function () {
    const fallbackPath = "/";
    try {
      Module.FS.mkdirTree(path);
    } catch (e) {
      console.error(`Error occurred while making a home directory '${path}':`);
      console.error(e);
      console.error(`Using '${fallbackPath}' for a home directory instead`);
      path = fallbackPath;
    }
    Module.ENV.HOME = path;
    Module.FS.chdir(path);
  });
}

/**
 * The Emscripten Module.
 *
 * @private
 */
export let Module: any = {};
Module.noImageDecoding = true;
Module.noAudioDecoding = true;
Module.noWasmDecoding = false; // we preload wasm using the built in plugin now
Module.preloadedWasm = {};
Module.preRun = [];

export let API: any = {};
Module.API = API;
export let Hiwire: any = {};
Module.hiwire = Hiwire;

// Put things that are exposed only for testing purposes here.
export let Tests: any = {};
API.tests = Tests;

/**
 *
 * @param stdin
 * @param stdout
 * @param stderr
 * @private
 */
export function setStandardStreams(
  stdin?: () => string,
  stdout?: (a: string) => void,
  stderr?: (a: string) => void
) {
  // For stdout and stderr, emscripten provides convenient wrappers that save us the trouble of converting the bytes into a string
  if (stdout) {
    Module.print = stdout;
  }

  if (stderr) {
    Module.printErr = stderr;
  }

  // For stdin, we have to deal with the low level API ourselves
  if (stdin) {
    Module.preRun.push(function () {
      Module.FS.init(createStdinWrapper(stdin), null, null);
    });
  }
}

function createStdinWrapper(stdin: () => string) {
  // When called, it asks the user for one whole line of input (stdin)
  // Then, it passes the individual bytes of the input to emscripten, one after another.
  // And finally, it terminates it with null.
  const encoder = new TextEncoder();
  let input = new Uint8Array(0);
  let inputIndex = -1; // -1 means that we just returned null
  function stdinWrapper() {
    try {
      if (inputIndex === -1) {
        let text = stdin();
        if (text === undefined || text === null) {
          return null;
        }
        if (typeof text !== "string") {
          throw new TypeError(
            `Expected stdin to return string, null, or undefined, got type ${typeof text}.`
          );
        }
        if (!text.endsWith("\n")) {
          text += "\n";
        }
        input = encoder.encode(text);
        inputIndex = 0;
      }

      if (inputIndex < input.length) {
        let character = input[inputIndex];
        inputIndex++;
        return character;
      } else {
        inputIndex = -1;
        return null;
      }
    } catch (e) {
      // emscripten will catch this and set an IOError which is unhelpful for
      // debugging.
      console.error("Error thrown in stdin:");
      console.error(e);
      throw e;
    }
  }
  return stdinWrapper;
}

/**
 * Make the home directory inside the virtual file system,
 * then change the working directory to it.
 *
 * @param path
 * @private
 */
export function setHomeDirectory(path: string) {
  Module.preRun.push(function () {
    const fallbackPath = "/";
    try {
      Module.FS.mkdirTree(path);
    } catch (e) {
      console.error(`Error occurred while making a home directory '${path}':`);
      console.error(e);
      console.error(`Using '${fallbackPath}' for a home directory instead`);
      path = fallbackPath;
    }
    Module.ENV.HOME = path;
    Module.FS.chdir(path);
  });
}
