Clarify the warning messages when it comes to authentication in (#2334)
This commit is contained in:
parent
3fd700adb2
commit
d3c8b2ded4
|
|
@ -77,6 +77,7 @@ module.exports = {
|
|||
};
|
||||
// If Grafana is behind auth, use it!
|
||||
if (options.grafana.auth) {
|
||||
log.debug('Using auth for Grafana');
|
||||
postOptions.headers.Authorization = 'Bearer ' + options.grafana.auth;
|
||||
}
|
||||
log.verbose('Send annotation to Grafana: %j', postData);
|
||||
|
|
@ -88,7 +89,13 @@ module.exports = {
|
|||
const e = new Error(
|
||||
`Got ${res.statusCode} from Grafana when sending annotation`
|
||||
);
|
||||
log.warn(e.message);
|
||||
if (res.statusCode === 403) {
|
||||
log.warn('Authentication required.', e.message)
|
||||
} else if (res.statusCode === 401) {
|
||||
log.warn('No valid authentication.', e.message)
|
||||
} else {
|
||||
log.warn(e.message);
|
||||
}
|
||||
reject(e);
|
||||
} else {
|
||||
res.setEncoding('utf8');
|
||||
|
|
|
|||
Loading…
Reference in New Issue