Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unhelpful error messages #39

Closed
maxcan opened this issue Jan 6, 2017 · 6 comments
Closed

unhelpful error messages #39

maxcan opened this issue Jan 6, 2017 · 6 comments

Comments

@maxcan
Copy link
Contributor

maxcan commented Jan 6, 2017

When calling tsoa swagger or tsoa routes:

node_modules/.bin/tsoa routes

Options:
  --help, -h           Show help  [boolean]
  --configuration, -c  tsoa configuration file; default is tsoa.json in the working directory  [string]

Cannot read property 'toLowerCase' of undefined

users.ts:

import {Get, Route, Post} from 'tsoa'
import * as Models from "../models"
import { getCxn } from "../db-util"
import * as Api from "../api-common"

export interface LoginArgs {
    email: string
     token: string
}
@Route('Users')
export class UsersController {
    @Post()
    public async createUser(email: string, token:string): Promise<Api.User> {
      return {} as Promise<Api.User>
//        return await getCxn().then(Models.loginUser(email, token, "DevManual"))
    }
}

api-common.d.ts:

export type AuthSource = "Cognito" | "Facebook" | "DevManual"

export interface DayPlan {
    title: string
}

export interface UserAuth {
    id: number
    token: string
    source: AuthSource
}

export interface User {
    email: string; days: DayPlan[]
}

tsoa.json:

{
    "swagger": {
        "outputDirectory": "./dist",
        "entryFile": "./src/controllers/users.ts",
        "basePath": "/v1",
        "name": "macrofit",
        "description": "macrofit"
    },
    "routes": {
        "basePath": "/api/v1",
        "entryFile": "./src/controllers/users.ts",
        "routesDir": "./src"
    }
}```
@lukeautry lukeautry mentioned this issue Jan 9, 2017
@lukeautry
Copy link
Owner

@maxcan I think this should be fixed with your PR, live in 1.0.11.

@maxcan
Copy link
Contributor Author

maxcan commented Jan 9, 2017 via email

@lukeautry lukeautry reopened this Jan 9, 2017
@lukeautry
Copy link
Owner

Yeah, stacktrace would definitely be useful. I'll look into it.

@maxcan
Copy link
Contributor Author

maxcan commented Jan 10, 2017

stack traces would be an easy win.

a big, but a bit harder win, would be if the errors could log the type that was being processed that caused the error.

@lukeautry
Copy link
Owner

@maxcan The errors should be a lot better as of 1.0.19.

In addition to stack traces, there's also a log error telling you what the type was when the error occurred; should make tracking down this stuff much easier.

Thanks for the feedback.

@maxcan
Copy link
Contributor Author

maxcan commented Feb 11, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants