Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Commit

Permalink
feat: update graphql error display
Browse files Browse the repository at this point in the history
  • Loading branch information
YanceyOfficial committed Apr 10, 2020
1 parent e3c37a5 commit bdbb34b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"space-before-function-paren": "off",
"func-names": "off",
"operator-linebreak": "off",
"indent": "off",
"import/no-extraneous-dependencies": "off",
"import/extensions": "off", // FIXME:
"class-methods-use-this": "off", // FIXME:
Expand Down
8 changes: 5 additions & 3 deletions src/bandwagon/bandwagon.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ export class BandwagonService {

public getServiceInfo(): Observable<AxiosResponse<ServiceInfo>> {
return this.httpService
.get(BANDWAGON_SERVICE_INFO_URL, { params: this.params })
.pipe(map(response => response.data))
.get(BANDWAGON_SERVICE_INFO_URL, {
params: this.params,
})
.pipe(map((response) => response.data))
}

public getUsageStats(): Observable<AxiosResponse<UsageStats>> {
return this.httpService
.get(BANDWAGON_USAGE_STATS_URL, { params: this.params })
.pipe(map(response => response.data.data))
.pipe(map((response) => response.data.data))
}
}
20 changes: 11 additions & 9 deletions src/graphql/graphqls.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Module } from '@nestjs/common'
import { GraphQLModule } from '@nestjs/graphql'
// import { ValidationError } from 'apollo-server-express'
import { ValidationError } from 'apollo-server-express'
import { ConfigService } from '../config/config.service'
import { SCHEMA_GQL_FILE_NAME } from '../shared/constants'
@Module({
Expand All @@ -13,14 +13,16 @@ import { SCHEMA_GQL_FILE_NAME } from '../shared/constants'
typePaths: ['./**/*.graphql'],
autoSchemaFile: SCHEMA_GQL_FILE_NAME,
context: ({ req }) => ({ req }),
// formatError(error: ValidationError) {
// const { message, path } = error
// return {
// message,
// path,
// timestamp: new Date(),
// }
// },
formatError(error: ValidationError) {
const { message, path } = error
return configService.isEnvProduction
? {
message,
path,
timestamp: new Date(),
}
: error
},
}),

inject: [ConfigService],
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@

"@nestjs/platform-express@^7.0.7":
version "7.0.7"
resolved "https://registry.yarnpkg.com/@nestjs/platform-express/-/platform-express-7.0.7.tgz#98067007365b015319d9d8421a1fc9d066f7b4df"
resolved "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-7.0.7.tgz#98067007365b015319d9d8421a1fc9d066f7b4df"
integrity sha512-jaQiJjz56Xv9BRBanTlEU+l8eo1fbugNoc4hNKeTFUPSPHQP3NULb5aeL8tbMnfHIxAdWhVueCmK+/TYLyQH8A==
dependencies:
body-parser "1.19.0"
Expand Down

0 comments on commit bdbb34b

Please sign in to comment.