message: Delete temp file, handle unexpected errors
diff: @@ -3,6 +3,8 @@ import Koa from 'koa';
  import KoaBody from 'koa-body';
  import { inject } from '@cardstack/di';
  import shortUuid from 'short-uuid';
  +import { unlink } from 'fs';
  +import * as Sentry from '@sentry/node';
  import { ensureLoggedIn } from './utils/auth';
  export interface Upload {
  @@ -59,6 +61,7 @@ export default class UploadRouter {
  let file = contextFiles[filename];
  let { size, type } = file;
  + try {
  let validationError = this.validate(size, type);
  if (validationError) {
  @@ -80,11 +83,19 @@ export default class UploadRouter {
  filename,
  size,
  type,
  - ownerAddress: ctx.state.userAddress,
  + ownerAddress: '0x0',
  });
  ctx.body = url;
  ctx.status = 200;
  + } catch (error) {
  + Sentry.captureException(error);
  + ctx.body = `Unexpected error while uploading`;
  + ctx.status = 422;
  + } finally {
  + console.log(file.path);
  + unlink(file.path, () => {});
  + }
  });
  return uploadRouter.routes();
  