Skip to content

Commit 58e7b40

Browse files
author
himaniraghav3
committed
log error only in dev mode
1 parent d081dcd commit 58e7b40

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/components/ChallengeEditor/Description-Field/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,11 @@ class DescriptionField extends Component {
782782
}).then(res => {
783783
onload(res)
784784
}).catch(err => {
785-
console.log('An unexpected error occured while uploading image')
785+
if (process.env.NODE_ENV === 'development') {
786+
console.log(err)
787+
} else {
788+
console.log('An unexpected error occured while uploading image')
789+
}
786790
onerror()
787791
})
788792
}

src/routes.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ class Routes extends React.Component {
9494
getFreshToken().then((token) => {
9595
this.props.saveToken(token)
9696
}).catch((error) => {
97-
console.error('An unexpected error occurred while getting auth token')
97+
if (process.env.NODE_ENV === 'development') {
98+
console.error(error)
99+
} else {
100+
console.error('An unexpected error occurred while getting auth token')
101+
}
98102
const redirectBackToUrl = window.location.origin + this.props.location.pathname
99103
window.location = ACCOUNTS_APP_LOGIN_URL + '?retUrl=' + redirectBackToUrl
100104
})

src/services/axiosWithAuth.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ export const getToken = () => {
1818
resolve(token)
1919
})
2020
.catch((err) => {
21-
console.error('Error getting auth token')
21+
if (process.env.NODE_ENV === 'development') {
22+
console.log(err)
23+
} else {
24+
console.error('Error getting auth token')
25+
}
2226
reject(err)
2327
})
2428
}
@@ -40,7 +44,11 @@ axiosInstance.interceptors.request.use(config => {
4044
return config
4145
})
4246
.catch((err) => {
43-
console.error('An unexpected error occured while retrieving the auth token.')
47+
if (process.env.NODE_ENV === 'development') {
48+
console.log(err)
49+
} else {
50+
console.error('An unexpected error occured while retrieving the auth token.')
51+
}
4452
const redirectBackToUrl = window.location.origin
4553
window.location = ACCOUNTS_APP_LOGIN_URL + '?retUrl=' + redirectBackToUrl
4654
})

0 commit comments

Comments
 (0)