Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log("scrollToMessage called with args:", messageModel.id, shouldHighlightMessageSelected, shouldOpenMessageSelected, callback, failedCallback, recursionDepth, originalRenderId);
}
recursionDepth = recursionDepth || 0;
originalRenderId = originalRenderId || _.clone(this._renderId);
var RETRY_INTERVAL = Math.floor(200 * Math.log(2 + recursionDepth)); // increasing interval
shouldHighlightMessageSelected = (typeof shouldHighlightMessageSelected === "undefined") ? true : shouldHighlightMessageSelected;
shouldOpenMessageSelected = (typeof shouldOpenMessageSelected === "undefined") ? true : shouldOpenMessageSelected;
if (!messageModel) {
throw new Error("scrollToMessage(): ERROR: messageModel wasn't provided");
}
if (recursionDepth === 0 && this._scrollToMessageInProgressId) {
Raven.captureMessage("scrollToMessage(): a scrollToMessage was already in progress, aborting", {message_id: messageModel.id})
if (_.isFunction(failedCallback)) {
failedCallback();
}
return;
}
else if (originalRenderId !== this._renderId) {
//This is a normal condition now
//console.log("scrollToMessage(): obsolete render, aborting for ", messageModel.id);
//Raven.captureMessage("scrollToMessage(): obsolete render, aborting", {message_id: messageModel.id})
if (this._scrollToMessageInProgressId === originalRenderId) {
this._scrollToMessageInProgressId = false;
}
if (_.isFunction(failedCallback)) {
failedCallback();
p.catch(response => {
let err = `Assigning allocation source: "${allocationName}" to "${instanceName}" failed`;
NotificationController.error("Error assigning allocation source", err);
if (Raven.isSetup()) {
Raven.captureMessage(err);
}
// Components that are using an optimistic version of instance, need
// to get sent the latest version of instance without the optimistic
// change to allocation_source
Utils.dispatch(InstanceConstants.UPDATE_INSTANCE, {instance});
});
const captureMessage = (message, data) => {
// only call if we have a configuration client available
if (Raven && Raven.isSetup()) {
Raven.captureMessage(message, {
extra: data
});
}
};
newState.isEditingAddress = false;
return newState;
}
case SAVE_ADDRESS_SUCCESS: {
const newState = Object.assign({}, state, { savePending: false });
return _.set('address', action.address, newState);
}
case SAVE_ADDRESS_FAILURE:
return { ...state, savePending: false, saveAddressError: true };
case GET_ADDRESS_COUNTRIES_SUCCESS: {
let countriesAvailable = true;
const countryList = action.countries.data.attributes.countries;
// Log error if the countries response is not what we expect
if (!Array.isArray(countryList) || countryList.length === 0) {
Raven.captureMessage(`vets_letters_unexpected_country_response: ${countryList}`);
countriesAvailable = false;
}
return {
...state,
countries: countryList,
countriesAvailable
};
}
case GET_ADDRESS_COUNTRIES_FAILURE:
return _.set('countriesAvailable', false, state);
case GET_ADDRESS_STATES_SUCCESS: {
let statesAvailable = true;
const stateList = action.states.data.attributes.states;
// Log error if the states response is not what we expect
}).fail(function (xhr, status, error) {
self.hide();
$osf.unblock();
var errorMessage = lodashGet(xhr, 'responseJSON.message') || ('There was a problem trying to add contributors.' + osfLanguage.REFRESH_OR_SUPPORT);
$osf.growl('Could not add contributors', errorMessage);
Raven.captureMessage('Error adding contributors', {
extra: {
url: url,
status: status,
error: error
}
});
});
},
}).fail(function(xhr, textStatus, error) {
var errorMessage = (xhr.status === 401) ? language.authInvalid : language.authError;
self.changeMessage(errorMessage, 'text-danger');
Raven.captureMessage('Could not authenticate with Dataverse', {
extra: {
url: url,
textStatus: textStatus,
error: error
}
});
});
};
private handleError = (): void => {
if (!this.state.hasErred && this.imgRef.current) {
const src = this.imgRef.current.src
if (Raven.captureMessage && !missingImages.has(src)) {
Raven.captureMessage(`Image source is no longer available: ${src}.`)
missingImages.add(src)
}
const {fallbackSrc} = this.props
if (fallbackSrc) {
this.imgRef.current.src = fallbackSrc
}
this.setState({hasErred: true})
}
}
reportSentryErrors = () => {
if (!Object.keys(this.userProfile).length) {
Raven.captureMessage('Unexpected response for user object');
} else if (!this.serviceName) {
Raven.captureMessage('Missing serviceName in user object');
}
};
}, function(xhr, textStatus, error) {
ctrl.failed = true;
ctrl.requestPending(false);
m.redraw();
Raven.captureMessage('Error retrieving quickfiles', {
extra: {
url: url,
textStatus: textStatus,
error: error
}
});
}
);
}).fail(function(xhr, status, error) {
Raven.captureMessage('Error while updating addon account', {
url: url, status: status, error: error
});
});
}