[IMP] test_lint, *: eslint remove caughtErrorsIgnorePattern from no-unused-vars
Unused catch block arguments are now forbidden even when prefixed with an underscore: if the argument on the catch block is not needed, the use of the optional catch binding is enforced. Part-of: odoo/odoo#105433
This commit is contained in:
@@ -68,7 +68,7 @@ class TaxGroupComponent extends Component {
|
||||
let newValue;
|
||||
try {
|
||||
newValue = parseFloat(this.inputTax.el.value); // Get the new value
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
this.inputTax.el.value = oldValue;
|
||||
this.setState("edit");
|
||||
return;
|
||||
|
||||
@@ -81,7 +81,7 @@ class LegacyTaxGroupComponent extends LegacyComponent {
|
||||
newValue = fieldUtils.parse.float(newValue); // Need a float for format the value
|
||||
newValue = fieldUtils.format.float(newValue, null, {digits: currency.digits}); // Return a string rounded to currency precision
|
||||
newValue = fieldUtils.parse.float(newValue); // Convert back to Float to compare with oldValue to know if value has changed
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
$(this.inputTax.el).addClass('o_field_invalid');
|
||||
this.setState('edit');
|
||||
return;
|
||||
|
||||
+1
-1
@@ -563,7 +563,7 @@ export class AnalyticDistribution extends Component {
|
||||
parse(value) {
|
||||
try {
|
||||
return typeof value === 'string' || value instanceof String ? oParseFloat(value.replace('%', '')) : value;
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export const barcodeGenericHandlers = {
|
||||
// the scanned barcode could be anything, and could crash the queryselectorall
|
||||
// function
|
||||
targets = getVisibleElements(ui.activeElement, `[barcode_trigger=${barcode.slice(6)}]`);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
console.warn(`Barcode '${barcode}' is not valid`);
|
||||
}
|
||||
for (let elem of targets) {
|
||||
|
||||
@@ -47,7 +47,7 @@ const ReCaptcha = Class.extend({
|
||||
return {
|
||||
token: await window.grecaptcha.execute(this._publicKey, {action: action})
|
||||
};
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
return {
|
||||
error: _t("The recaptcha site key is invalid."),
|
||||
};
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ const PublicLivechatWindow = Widget.extend({
|
||||
async _postMessage(messageData) {
|
||||
try {
|
||||
await this.messaging.publicLivechatGlobal.livechatButtonView.sendMessage(messageData);
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
await this.messaging.publicLivechatGlobal.livechatButtonView.sendMessage(messageData); // try again just in case
|
||||
}
|
||||
this.messaging.publicLivechatGlobal.publicLivechat.widget.postMessage(messageData)
|
||||
|
||||
@@ -204,7 +204,7 @@ Model({
|
||||
message: this.env._t("No available collaborator, please try again later."),
|
||||
sticky: true,
|
||||
});
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
/**
|
||||
* Failure in displaying notification happens when
|
||||
* notification service doesn't exist, which is the case in
|
||||
@@ -283,7 +283,7 @@ Model({
|
||||
message: this.env._t("Session expired... Please refresh and try again."),
|
||||
sticky: true,
|
||||
});
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
/**
|
||||
* Failure in displaying notification happens when
|
||||
* notification service doesn't exist, which is the case
|
||||
|
||||
@@ -20,7 +20,7 @@ function parseAndTransform(htmlString, transformFunction) {
|
||||
var children;
|
||||
try {
|
||||
children = $('<div>').html(string).contents();
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
children = $('<div>').html('<pre>' + string + '</pre>').contents();
|
||||
}
|
||||
return _parseAndTransform(children, transformFunction)
|
||||
@@ -99,7 +99,7 @@ function htmlToTextContentInline(htmlString) {
|
||||
htmlString = htmlString.replace(/<br\s*\/?>/gi,' ');
|
||||
try {
|
||||
div.innerHTML = htmlString;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
div.innerHTML = `<pre>${htmlString}</pre>`;
|
||||
}
|
||||
return div
|
||||
|
||||
@@ -35,7 +35,7 @@ Model({
|
||||
if (this.exists()) {
|
||||
this.update({ isFullScreen: true });
|
||||
}
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
if (this.exists()) {
|
||||
this.update({ isFullScreen: false });
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ Model({
|
||||
try {
|
||||
const audioStream = await browser.navigator.mediaDevices.getUserMedia({ audio: this.messaging.userSetting.getAudioConstraints() });
|
||||
audioTrack = audioStream.getAudioTracks()[0];
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
this.messaging.notify({
|
||||
message: sprintf(
|
||||
this.env._t(`"%s" requires microphone access`),
|
||||
@@ -329,7 +329,7 @@ Model({
|
||||
},
|
||||
),
|
||||
});
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
/**
|
||||
* The browser is probably missing audioContext,
|
||||
* in that case, voice activation is not enabled
|
||||
@@ -716,14 +716,14 @@ Model({
|
||||
for (const sender of RTCRtpSenders) {
|
||||
try {
|
||||
peerConnection.removeTrack(sender);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// ignore error
|
||||
}
|
||||
}
|
||||
for (const transceiver of peerConnection.getTransceivers()) {
|
||||
try {
|
||||
transceiver.stop();
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// transceiver may already be stopped by the remote.
|
||||
}
|
||||
}
|
||||
@@ -946,7 +946,7 @@ Model({
|
||||
sourceWebMediaStream = await browser.navigator.mediaDevices.getDisplayMedia({ video: this.videoConfig });
|
||||
this.messaging.soundEffects.screenSharing.play();
|
||||
}
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
this.messaging.notify({
|
||||
message: sprintf(
|
||||
this.env._t(`"%s" requires "%s" access`),
|
||||
|
||||
@@ -187,7 +187,7 @@ Model({
|
||||
try {
|
||||
await transceiver.sender.replaceTrack(track);
|
||||
transceiver.direction = transceiverDirection;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// ignored, the track is probably already on the peerConnection.
|
||||
}
|
||||
return;
|
||||
@@ -195,7 +195,7 @@ Model({
|
||||
try {
|
||||
await transceiver.sender.replaceTrack(null);
|
||||
transceiver.direction = transceiverDirection;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// ignored, the transceiver is probably already removed
|
||||
}
|
||||
if (trackKind === 'video') {
|
||||
@@ -224,7 +224,7 @@ Model({
|
||||
this.audioElement.pause();
|
||||
try {
|
||||
this.audioElement.srcObject = undefined;
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
// ignore error during remove, the value will be overwritten at next usage anyway
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ Model({
|
||||
try {
|
||||
fetchedMessages = await this._loadMessages({ limit, maxId: Math.min(...messageIds) });
|
||||
success = true;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
success = false;
|
||||
}
|
||||
if (!this.exists()) {
|
||||
|
||||
@@ -37,7 +37,7 @@ export async function monitorAudio(track, processorOptions) {
|
||||
let processor;
|
||||
try {
|
||||
processor = await _loadAudioWorkletProcessor(source, audioContext, processorOptions);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// In case Worklets are not supported by the browser (eg: Safari)
|
||||
processor = _loadScriptProcessor(source, audioContext, processorOptions);
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ QUnit.test('[technical] does not crash when the viewer is closed before image lo
|
||||
try {
|
||||
imageEl.dispatchEvent(new Event('load', { bubbles: true }));
|
||||
successfulLoad = true;
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
successfulLoad = false;
|
||||
} finally {
|
||||
assert.ok(successfulLoad, 'should not crash when the image is loaded');
|
||||
|
||||
@@ -44,7 +44,7 @@ odoo.define('point_of_sale.AbstractReceiptScreen', function (require) {
|
||||
try {
|
||||
window.print();
|
||||
return true;
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
await this.showPopup('ErrorPopup', {
|
||||
title: this.env._t('Printing is not supported on some browsers'),
|
||||
body: this.env._t(
|
||||
|
||||
@@ -22,7 +22,7 @@ odoo.define('point_of_sale.CashMovePopup', function (require) {
|
||||
confirm() {
|
||||
try {
|
||||
parse.float(this.state.inputAmount);
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
this.state.inputHasError = true;
|
||||
this.errorMessage = this.env._t('Invalid amount');
|
||||
return;
|
||||
|
||||
@@ -51,7 +51,7 @@ odoo.define('point_of_sale.ReceiptScreen', function (require) {
|
||||
await this._sendReceiptToCustomer();
|
||||
this.orderUiState.emailSuccessful = true;
|
||||
this.orderUiState.emailNotice = this.env._t('Email sent.');
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
this.orderUiState.emailSuccessful = false;
|
||||
this.orderUiState.emailNotice = this.env._t('Sending email failed. Please try again.');
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ var PosDB = core.Class.extend({
|
||||
query = query.replace(/[\[\]\(\)\+\*\?\.\-\!\&\^\$\|\~\_\{\}\:\,\\\/]/g,'.');
|
||||
query = query.replace(/ /g,'.+');
|
||||
var re = RegExp("([0-9]+):.*?"+utils.unaccent(query),"gi");
|
||||
}catch(_e){
|
||||
}catch{
|
||||
return [];
|
||||
}
|
||||
var results = [];
|
||||
@@ -401,7 +401,7 @@ var PosDB = core.Class.extend({
|
||||
query = query.replace(/[\[\]\(\)\+\*\?\.\-\!\&\^\$\|\~\_\{\}\:\,\\\/]/g,'.');
|
||||
query = query.replace(/ /g,'.+');
|
||||
var re = RegExp("([0-9]+):.*?"+utils.unaccent(query),"gi");
|
||||
}catch(_e){
|
||||
}catch{
|
||||
return [];
|
||||
}
|
||||
var results = [];
|
||||
|
||||
@@ -1479,7 +1479,7 @@ class Orderline extends PosModel {
|
||||
if (options.json) {
|
||||
try {
|
||||
this.init_from_JSON(options.json);
|
||||
} catch(_error) {
|
||||
} catch {
|
||||
console.error('ERROR: attempting to recover product ID', options.json.product_id,
|
||||
'not available in the point of sale. Correct the product or clean the browser cache.');
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ var PrinterMixin = {
|
||||
image = await this.htmlToImg(receipt);
|
||||
try {
|
||||
sendPrintResult = await this.send_printing_job(image);
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
// Error in communicating to the IoT box.
|
||||
this.receipt_queue.length = 0;
|
||||
return this.printResultGenerator.IoTActionError();
|
||||
|
||||
@@ -64,7 +64,7 @@ export const PosLoyaltyPaymentScreen = (PaymentScreen) =>
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// Do nothing with error, while this validation step is nice for error messages
|
||||
// it should not be blocking.
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ const PosMercuryPosGlobalState = (PosGlobalState) => class PosMercuryPosGlobalSt
|
||||
magtek_generated.shift(); // reader enc status
|
||||
|
||||
return to_return;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ odoo.define('pos_restaurant.TicketScreen', function (require) {
|
||||
}
|
||||
this.env.pos.removeOrder(order);
|
||||
return true;
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
const { confirmed } = await this.showPopup('ConfirmPopup', {
|
||||
title: 'Failed to set tip',
|
||||
body: `Failed to set tip to ${order.name}. Do you want to proceed on setting the tips of the remaining?`,
|
||||
|
||||
@@ -143,7 +143,7 @@ odoo.define('pos_restaurant.TipScreen', function (require) {
|
||||
try {
|
||||
$(this.el).find('.pos-receipt-container').html(receipt);
|
||||
window.print();
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
await this.showPopup('ErrorPopup', {
|
||||
title: this.env._t('Printing is not supported on some browsers'),
|
||||
body: this.env._t(
|
||||
|
||||
@@ -88,7 +88,7 @@ odoo.define('pos_sale.SaleOrderManagementScreen', function (require) {
|
||||
try {
|
||||
await this.env.pos.load_new_partners();
|
||||
}
|
||||
catch (_error){
|
||||
catch {
|
||||
}
|
||||
let order_partner = this.env.pos.db.get_partner_by_id(sale_order.partner_id[0])
|
||||
if(order_partner){
|
||||
@@ -97,7 +97,7 @@ odoo.define('pos_sale.SaleOrderManagementScreen', function (require) {
|
||||
try {
|
||||
await this.env.pos._loadPartners([sale_order.partner_id[0]]);
|
||||
}
|
||||
catch (_error){
|
||||
catch {
|
||||
const title = this.env._t('Customer loading error');
|
||||
const body = _.str.sprintf(this.env._t('There was a problem in loading the %s customer.'), sale_order.partner_id[1]);
|
||||
await this.showPopup('ErrorPopup', { title, body });
|
||||
|
||||
@@ -95,7 +95,7 @@ var GeneratePriceList = AbstractAction.extend(StandaloneFieldManagerMixin, {
|
||||
try {
|
||||
this.context.active_ids = params.params.active_ids.split(',').map(id => parseInt(id));
|
||||
this.context.active_model = params.params.active_model;
|
||||
} catch(_e) {
|
||||
} catch {
|
||||
console.log('unable to load ids from the url fragment 🙁');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const { DateTime } = luxon;
|
||||
const isValidStaticFormat = (format) => {
|
||||
try {
|
||||
return /^[\d\s/:-]+$/.test(DateTime.local().toFormat(format));
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ export function getOdooFunctions(formula, matcher) {
|
||||
let ast;
|
||||
try {
|
||||
ast = parse(formula);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
return _getOdooFunctionsFromAST(ast, matcher);
|
||||
|
||||
@@ -67,7 +67,7 @@ function migrate1to2(data) {
|
||||
if (cell.content && cell.content.startsWith("=")) {
|
||||
try {
|
||||
cell.content = migratePivotDaysParameters(cell.content);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ export class SpreadsheetPivotModel extends PivotModel {
|
||||
try {
|
||||
const { field } = this.parseGroupField(fieldName);
|
||||
return this._isCol(field);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
false;
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ export class SpreadsheetPivotModel extends PivotModel {
|
||||
try {
|
||||
const { field } = this.parseGroupField(fieldName);
|
||||
return this._isRow(field);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,18 +116,27 @@ export function parseAccountingDate(dateRange) {
|
||||
parseAccountingYear(dateRange) ||
|
||||
parseAccountingDay(dateRange)
|
||||
);
|
||||
} catch (_) {
|
||||
throw new Error(sprintf(_t(`'%s' is not a valid period. Supported formats are "21/12/2022", "Q1/2022", "12/2022", and "2022".`), dateRange));
|
||||
} catch {
|
||||
throw new Error(
|
||||
sprintf(
|
||||
_t(
|
||||
`'%s' is not a valid period. Supported formats are "21/12/2022", "Q1/2022", "12/2022", and "2022".`
|
||||
),
|
||||
dateRange
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const ODOO_FIN_ARGS = `
|
||||
account_codes (string) ${_t("The prefix of the accounts.")}
|
||||
date_range (string, date) ${_t(`The date range. Supported formats are "21/12/2022", "Q1/2022", "12/2022", and "2022".`)}
|
||||
date_range (string, date) ${_t(
|
||||
`The date range. Supported formats are "21/12/2022", "Q1/2022", "12/2022", and "2022".`
|
||||
)}
|
||||
offset (number, default=0) ${_t("Year offset applied to date_range.")}
|
||||
company_id (number, optional) ${_t("The company to target (Advanced).")}
|
||||
include_unposted (boolean, default=TRUE) ${_t("Set to TRUE to include unposted entries.")}
|
||||
`
|
||||
`;
|
||||
|
||||
functionRegistry.add("ODOO.CREDIT", {
|
||||
description: _t("Get the total credit for the specified account(s) and period."),
|
||||
|
||||
@@ -15,7 +15,7 @@ try {
|
||||
// Safari crashes in Private Browsing
|
||||
localStorage.setItem("__localStorage__", "true");
|
||||
localStorage.removeItem("__localStorage__");
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
localStorage = makeRAMLocalStorage();
|
||||
sessionStorage = makeRAMLocalStorage();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export class DomainSelector extends Component {
|
||||
this.traverseNode(ctx);
|
||||
|
||||
return ctx.parent;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// WOWL TODO: rethrow error when not the expected type
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export class DomainSelectorFieldInput extends Component {
|
||||
const parser = parsers.get(this.props.field.type, (value) => value);
|
||||
try {
|
||||
return parser(value);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ export async function annotateTraceback(error) {
|
||||
const traceback = formatTraceback(error);
|
||||
try {
|
||||
await _loadJS("/web/static/lib/stacktracejs/stacktrace.js");
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
return traceback;
|
||||
}
|
||||
// In Firefox, the error stack generated by anonymous code (example: invalid
|
||||
|
||||
@@ -22,7 +22,7 @@ export class ModelFieldSelectorPopover extends Component {
|
||||
this.fullFieldName = this.fieldNameChain.join(".");
|
||||
if (!this.env.isSmall) {
|
||||
useAutofocus();
|
||||
useAutofocus({ refName: 'autofocusDefaultValue', selectAll: true });
|
||||
useAutofocus({ refName: "autofocusDefaultValue", selectAll: true });
|
||||
}
|
||||
|
||||
onWillStart(async () => {
|
||||
@@ -48,9 +48,9 @@ export class ModelFieldSelectorPopover extends Component {
|
||||
|
||||
async loadFields() {
|
||||
this.unfilteredFields = await this.modelField.loadModelFields(this.currentNode.resModel);
|
||||
this.fields = {...this.unfilteredFields};
|
||||
this.fields = { ...this.unfilteredFields };
|
||||
this.fieldKeys = this.sortedKeys(this.fields);
|
||||
for (let key of this.fieldKeys) {
|
||||
for (const key of this.fieldKeys) {
|
||||
const field = this.fields[key];
|
||||
if (!field.searchable || !this.props.filter(field)) {
|
||||
delete this.fields[key];
|
||||
@@ -75,7 +75,7 @@ export class ModelFieldSelectorPopover extends Component {
|
||||
case "ArrowUp":
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
if (this.currentActiveFieldId> 0) {
|
||||
if (this.currentActiveFieldId > 0) {
|
||||
this.currentActiveFieldId--;
|
||||
await this.render();
|
||||
}
|
||||
@@ -83,7 +83,7 @@ export class ModelFieldSelectorPopover extends Component {
|
||||
case "ArrowDown":
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
if (this.currentActiveFieldId < this.fieldKeys.length-1) {
|
||||
if (this.currentActiveFieldId < this.fieldKeys.length - 1) {
|
||||
this.currentActiveFieldId++;
|
||||
await this.render();
|
||||
}
|
||||
@@ -105,7 +105,10 @@ export class ModelFieldSelectorPopover extends Component {
|
||||
if (this.isDefaultValueVisible) {
|
||||
this.selectDefaultValue(true);
|
||||
} else {
|
||||
const field = { ...this.fields[this.currentActiveField], name: this.currentActiveField }
|
||||
const field = {
|
||||
...this.fields[this.currentActiveField],
|
||||
name: this.currentActiveField,
|
||||
};
|
||||
this.onFieldSelected(field);
|
||||
}
|
||||
break;
|
||||
@@ -142,7 +145,7 @@ export class ModelFieldSelectorPopover extends Component {
|
||||
field: null,
|
||||
});
|
||||
this.update();
|
||||
} else if(this.props.needDefaultValue) {
|
||||
} else if (this.props.needDefaultValue) {
|
||||
this.isDefaultValueVisible = true;
|
||||
this.render();
|
||||
this.update();
|
||||
@@ -152,7 +155,7 @@ export class ModelFieldSelectorPopover extends Component {
|
||||
this.props.validate(this.fieldNameChain, this.defaultValue);
|
||||
}
|
||||
}
|
||||
selectDefaultValue (acceptDefaultValue) {
|
||||
selectDefaultValue(acceptDefaultValue) {
|
||||
if (!acceptDefaultValue) {
|
||||
this.defaultValue = "";
|
||||
}
|
||||
@@ -166,7 +169,7 @@ export class ModelFieldSelectorPopover extends Component {
|
||||
try {
|
||||
this.chain = await this.props.loadChain(resModel, this.fullFieldName);
|
||||
this.update();
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
// WOWL TODO: rethrow error when not the expected type
|
||||
this.chain = [{ resModel, field: null }];
|
||||
await this.props.update([]);
|
||||
@@ -186,13 +189,13 @@ ModelFieldSelectorPopover.props = {
|
||||
chain: Array,
|
||||
update: Function,
|
||||
showSearchInput: Boolean,
|
||||
isDebugMode: { type: Boolean, optional: true},
|
||||
isDebugMode: { type: Boolean, optional: true },
|
||||
loadChain: Function,
|
||||
filter: Function,
|
||||
close: Function,
|
||||
followRelations: { type: Boolean, optional: true },
|
||||
needDefaultValue: { type: Boolean, optional: true},
|
||||
validate: { type: Function, optional: true},
|
||||
needDefaultValue: { type: Boolean, optional: true },
|
||||
validate: { type: Function, optional: true },
|
||||
};
|
||||
|
||||
ModelFieldSelectorPopover.template = "web.ModelFieldSelectorPopover";
|
||||
ModelFieldSelectorPopover.template = "web.ModelFieldSelectorPopover";
|
||||
|
||||
@@ -423,7 +423,7 @@ function _download(data, filename, mimetype) {
|
||||
if (typeof blob === "string" || blob.constructor === toString) {
|
||||
try {
|
||||
return saver(`data:${mimeType};base64,${self.btoa(blob)}`);
|
||||
} catch (_y) {
|
||||
} catch {
|
||||
return saver(`data:${mimeType},${encodeURIComponent(blob)}`);
|
||||
}
|
||||
}
|
||||
@@ -505,7 +505,7 @@ download._download = (options) => {
|
||||
// a Serialized python Error
|
||||
const node = nodes[1] || nodes[0];
|
||||
error = JSON.parse(node.textContent);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
error = {
|
||||
message: "Arbitrary Uncaught Python Exception",
|
||||
data: {
|
||||
|
||||
@@ -69,7 +69,7 @@ export function jsonrpc(env, rpcId, url, params, settings = {}) {
|
||||
let params;
|
||||
try {
|
||||
params = JSON.parse(request.response);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
reject(
|
||||
new HTTPError(
|
||||
`server responded with invalid JSON response (HTTP${request.status}): ${request.response}`
|
||||
|
||||
@@ -38,7 +38,7 @@ export const scrollerService = {
|
||||
let matchingEl = null;
|
||||
try {
|
||||
matchingEl = document.querySelector(`.o_content #${href.value.substr(1)}`);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// Invalid selector: not an anchor anyway
|
||||
}
|
||||
const triggerEv = new CustomEvent("anchor-link-clicked", {
|
||||
|
||||
@@ -173,7 +173,7 @@ export function searchModelStateToLegacy(state) {
|
||||
let context = item.context;
|
||||
try {
|
||||
context = makeContext([context]);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
filter.context = context;
|
||||
|
||||
@@ -112,7 +112,7 @@ odoo.define('web.DatePickerOwl', function (require) {
|
||||
_formatDate(date) {
|
||||
try {
|
||||
return field_utils.format[this.typeOfDate](date, null, { timezone: false });
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ odoo.define('web.DatePickerOwl', function (require) {
|
||||
_parseInput(inputValue) {
|
||||
try {
|
||||
return field_utils.parse[this.typeOfDate](inputValue, null, { timezone: false });
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ odoo.define('web.Pager', function (require) {
|
||||
async _changeSelection(direction) {
|
||||
try {
|
||||
await this.props.validate();
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
const { limit, size } = this.props;
|
||||
@@ -115,7 +115,7 @@ odoo.define('web.Pager', function (require) {
|
||||
async _saveValue(value) {
|
||||
try {
|
||||
await this.props.validate();
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
const [min, max] = value.trim().split(/\s*[\-\s,;]\s*/);
|
||||
|
||||
@@ -904,7 +904,7 @@ odoo.define("web/static/src/js/control_panel/control_panel_model_extension.js",
|
||||
child.attrs.defaultInterval = context.group_by.split(':')[1];
|
||||
child.tag = 'groupBy';
|
||||
}
|
||||
} catch (_e) { }
|
||||
} catch { }
|
||||
}
|
||||
if (child.attrs.name in this.searchDefaults) {
|
||||
child.attrs.isDefault = true;
|
||||
|
||||
@@ -265,7 +265,7 @@ odoo.define('web.CustomFilterItem', function (require) {
|
||||
condition.value = field_utils.parse[type](ev.target.value);
|
||||
// Write displayed value in the input and 'displayedValue' property
|
||||
condition.displayedValue = ev.target.value;
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
// Parsing error: reverts to previous value
|
||||
ev.target.value = condition.displayedValue;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ odoo.define('web.SearchBar', function (require) {
|
||||
if (typeof args === 'string') {
|
||||
try {
|
||||
args = Domain.prototype.stringToArray(args);
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
args = [];
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ odoo.define('web.SearchBar', function (require) {
|
||||
_validateSource(query, source) {
|
||||
try {
|
||||
this._parseWithSource(query, source);
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -201,7 +201,7 @@ function get_file(options) {
|
||||
try { // Case of a serialized Odoo Exception: It is Json Parsable
|
||||
var node = nodes[1] || nodes[0];
|
||||
err = JSON.parse(node.textContent);
|
||||
} catch (_e) { // Arbitrary uncaught python side exception
|
||||
} catch { // Arbitrary uncaught python side exception
|
||||
err = {
|
||||
message: nodes.length > 1 ? nodes[1].textContent : '',
|
||||
data: {
|
||||
|
||||
@@ -39,12 +39,12 @@ try {
|
||||
key: key,
|
||||
newValue: newValue,
|
||||
});
|
||||
} catch (_error) {}
|
||||
} catch {}
|
||||
});
|
||||
return storage;
|
||||
})();
|
||||
|
||||
} catch (_exception) {
|
||||
} catch {
|
||||
console.warn('Fail to load localStorage');
|
||||
storage = new RamStorage();
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
|
||||
if(cookie.indexOf(nameEQ) === 0) {
|
||||
try {
|
||||
return JSON.parse(decodeURIComponent(cookie.substring(nameEQ.length)));
|
||||
} catch(_err) {
|
||||
} catch {
|
||||
// wrong cookie, delete it
|
||||
this.set_cookie(name, '', -1);
|
||||
}
|
||||
|
||||
@@ -41,12 +41,12 @@ try {
|
||||
newValue: newValue,
|
||||
});
|
||||
}
|
||||
} catch (_error) {}
|
||||
} catch {}
|
||||
});
|
||||
return storage;
|
||||
})();
|
||||
|
||||
} catch (_exception) {
|
||||
} catch {
|
||||
console.warn('Fail to load sessionStorage');
|
||||
storage = new RamStorage();
|
||||
}
|
||||
|
||||
@@ -183,13 +183,13 @@ function time_to_str (obj) {
|
||||
function auto_str_to_date (value) {
|
||||
try {
|
||||
return str_to_datetime(value);
|
||||
} catch(_e) {}
|
||||
} catch {}
|
||||
try {
|
||||
return str_to_date(value);
|
||||
} catch(_e) {}
|
||||
} catch {}
|
||||
try {
|
||||
return str_to_time(value);
|
||||
} catch(_e) {}
|
||||
} catch {}
|
||||
throw new Error(_.str.sprintf(_t("'%s' is not a correct date, datetime nor time"), value));
|
||||
}
|
||||
|
||||
|
||||
@@ -572,7 +572,7 @@ var AbstractField = Widget.extend({
|
||||
try {
|
||||
value = this._parseValue(value);
|
||||
this._isValid = true;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
this._isValid = false;
|
||||
this.trigger_up('set_dirty', {dataPointID: this.dataPointID});
|
||||
return Promise.reject({message: "Value set is not valid"});
|
||||
|
||||
@@ -537,7 +537,7 @@ odoo.define('web.AbstractFieldOwl', function (require) {
|
||||
try {
|
||||
value = this._parseValue(value);
|
||||
this._isValid = true;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
this._isValid = false;
|
||||
this.trigger('set-dirty', {dataPointID: this.dataPointId});
|
||||
return Promise.reject({message: "Value set is not valid"});
|
||||
|
||||
@@ -612,7 +612,7 @@ var NumericField = InputField.extend({
|
||||
value = this._formatValue(value);
|
||||
// Set the computed value in the input
|
||||
this.$input.val(value);
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
// in case of exception, set value as the original value
|
||||
// that way the Webclient will show an error as
|
||||
// it is expecting a numeric value.
|
||||
@@ -801,7 +801,7 @@ var FieldDateRange = InputField.extend({
|
||||
const value = this.mode === "readonly" ? this.value : this.$input.val();
|
||||
try {
|
||||
return field_utils.parse[this.formatType](value, this.field, { timezone: true }) || true;
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -821,7 +821,7 @@ var FieldDateRange = InputField.extend({
|
||||
// user may enter manual value in input and it may not be parsed as date/datetime value
|
||||
this.removeInvalidClass();
|
||||
return field_utils.parse[this.formatType](this.$input.val(), this.field, { timezone: true });
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
this.setInvalidClass();
|
||||
return false;
|
||||
}
|
||||
@@ -1094,7 +1094,7 @@ var FieldDate = InputField.extend({
|
||||
if (this.datewidget.type_of_date === "datetime") {
|
||||
value.add(-this.getSession().getTZOffset(value), "minutes");
|
||||
}
|
||||
} catch (_err) {}
|
||||
} catch {}
|
||||
await this._setValue(value);
|
||||
this._render();
|
||||
}
|
||||
@@ -3340,7 +3340,7 @@ var FieldProgressBar = AbstractField.extend({
|
||||
try {
|
||||
// Cover all numbers with parseFloat
|
||||
parsedValue = field_utils.parse.float($input.val());
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
this.displayNotification({ message: _t("Please enter a numerical value"), type: 'danger' });
|
||||
}
|
||||
|
||||
@@ -4284,7 +4284,7 @@ var FieldColorPicker = FieldInteger.extend({
|
||||
_highlightSelectedColor: function(){
|
||||
try{
|
||||
$(this.$('li')[parseInt(this.value)]).css('border', '2px solid teal');
|
||||
} catch(_err) {
|
||||
} catch {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3178,7 +3178,7 @@ var FieldStatus = AbstractField.extend({
|
||||
// If not set, the statusbar is not clickable.
|
||||
try {
|
||||
this.isClickable = !!JSON.parse(this.attrs.clickable);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
this.isClickable = !!this.nodeOptions.clickable;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -200,7 +200,7 @@ var KanbanController = BasicController.extend({
|
||||
}
|
||||
try {
|
||||
var visible = new Domain(domain).compute(data.evalContext);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
if (!visible) {
|
||||
|
||||
@@ -155,7 +155,7 @@ var DateWidget = Widget.extend({
|
||||
try {
|
||||
this._parseClient(value);
|
||||
return true;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ var DomainTree = DomainNode.extend({
|
||||
try {
|
||||
parsedDomain = Domain.prototype.stringToArray(domain);
|
||||
this.invalidDomain = false;
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
// TODO: domain could contain `parent` for example, which is
|
||||
// currently not handled by the DomainSelector
|
||||
this.invalidDomain = true;
|
||||
@@ -603,7 +603,7 @@ var DomainSelector = DomainTree.extend({
|
||||
const rawDomain = e.currentTarget.value;
|
||||
try {
|
||||
Domain.prototype.stringToArray(rawDomain);
|
||||
} catch (_err) { // If there is a syntax error, just ignore the change
|
||||
} catch { // If there is a syntax error, just ignore the change
|
||||
this.displayNotification({ title: _t("Syntax error"), message: _t("Domain not properly formed"), type: 'danger' });
|
||||
return;
|
||||
}
|
||||
@@ -712,7 +712,7 @@ var DomainLeaf = DomainNode.extend({
|
||||
if (selectedField && !selectedField.relation && !_.isArray(this.value)) {
|
||||
this.displayValue = field_utils.format[selectedField.type](this.value, selectedField);
|
||||
}
|
||||
} catch (_err) {/**/}
|
||||
} catch {/**/}
|
||||
this.displayOperator = this.operator;
|
||||
if (selectedField.type === "boolean") {
|
||||
this.displayValue = this.value ? "1" : "0";
|
||||
@@ -846,7 +846,7 @@ var DomainLeaf = DomainNode.extend({
|
||||
var selectedField = this.fieldSelector.getSelectedField() || {};
|
||||
try {
|
||||
this.value = field_utils.parse[selectedField.type](value, selectedField);
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
this.value = value;
|
||||
couldNotParse = true;
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ export class CustomFilterItem extends Component {
|
||||
// Only updates values if it can be correctly parsed and formatted.
|
||||
condition.value = parsed;
|
||||
condition.displayedValue = formatted;
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
// Parsing error: nothing is done
|
||||
}
|
||||
// Only reset the target's value if it is not a selection field.
|
||||
|
||||
@@ -20,7 +20,7 @@ const DEFAULT_VIEWS_WITH_SEARCH_PANEL = ["kanban", "list"];
|
||||
function getContextGroubBy(context) {
|
||||
try {
|
||||
return makeContext([context]).group_by.split(":");
|
||||
} catch (_err) {
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export class SearchBar extends Component {
|
||||
value = parser(trimmedQuery);
|
||||
}
|
||||
}
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ export class SearchBar extends Component {
|
||||
if (searchItem.domain) {
|
||||
try {
|
||||
domain = new Domain(searchItem.domain).toList();
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// Pass
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,23 +59,27 @@ export class DomainField extends Component {
|
||||
}
|
||||
|
||||
onButtonClick() {
|
||||
this.addDialog(SelectCreateDialog, {
|
||||
title: this.env._t("Selected records"),
|
||||
noCreate: true,
|
||||
multiSelect: false,
|
||||
resModel: this.getResModel(this.props),
|
||||
domain: this.getDomain(this.props.value).toList(this.getContext(this.props)) || [],
|
||||
context: this.getContext(this.props) || {},
|
||||
}, {
|
||||
// The counter is reloaded "on close" because some modal allows to modify data that can impact the counter
|
||||
onClose: () => this.loadCount(this.props)
|
||||
});
|
||||
this.addDialog(
|
||||
SelectCreateDialog,
|
||||
{
|
||||
title: this.env._t("Selected records"),
|
||||
noCreate: true,
|
||||
multiSelect: false,
|
||||
resModel: this.getResModel(this.props),
|
||||
domain: this.getDomain(this.props.value).toList(this.getContext(this.props)) || [],
|
||||
context: this.getContext(this.props) || {},
|
||||
},
|
||||
{
|
||||
// The counter is reloaded "on close" because some modal allows to modify data that can impact the counter
|
||||
onClose: () => this.loadCount(this.props),
|
||||
}
|
||||
);
|
||||
}
|
||||
get isValidDomain() {
|
||||
try {
|
||||
this.getDomain(this.props.value).toList();
|
||||
return true;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// WOWL TODO: rethrow error when not the expected type
|
||||
return false;
|
||||
}
|
||||
@@ -98,7 +102,7 @@ export class DomainField extends Component {
|
||||
[domain],
|
||||
{ context: this.getContext(props) }
|
||||
);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// WOWL TODO: rethrow error when not the expected type
|
||||
Object.assign(this.state, { recordCount: 0, isValid: false });
|
||||
return;
|
||||
|
||||
@@ -55,7 +55,7 @@ export function useInputField(params) {
|
||||
if (params.parse) {
|
||||
try {
|
||||
val = params.parse(val);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
if (component.props.record) {
|
||||
component.props.record.setInvalidField(component.props.name);
|
||||
}
|
||||
@@ -103,7 +103,9 @@ export function useInputField(params) {
|
||||
* If it is not such a case, we update the field with the new value.
|
||||
*/
|
||||
useEffect(() => {
|
||||
const isInvalid = component.props.record ? component.props.record.isInvalid(component.props.name) : false;
|
||||
const isInvalid = component.props.record
|
||||
? component.props.record.isInvalid(component.props.name)
|
||||
: false;
|
||||
if (inputRef.el && !isDirty && !isInvalid) {
|
||||
inputRef.el.value = params.getValue();
|
||||
lastSetValue = inputRef.el.value;
|
||||
@@ -131,7 +133,7 @@ export function useInputField(params) {
|
||||
if (params.parse) {
|
||||
try {
|
||||
val = params.parse(val);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
isInvalid = true;
|
||||
if (urgent) {
|
||||
return;
|
||||
|
||||
@@ -140,7 +140,7 @@ export class PropertyDefinition extends Component {
|
||||
* @param {event} event
|
||||
*/
|
||||
onPropertyLabelKeypress(event) {
|
||||
if (event.key !== 'Enter') {
|
||||
if (event.key !== "Enter") {
|
||||
return;
|
||||
}
|
||||
this.props.close();
|
||||
@@ -177,8 +177,8 @@ export class PropertyDefinition extends Component {
|
||||
|
||||
this.props.onChange(propertyDefinition);
|
||||
this.state.propertyDefinition = propertyDefinition;
|
||||
this.state.resModel = '';
|
||||
this.state.resModelDescription = '';
|
||||
this.state.resModel = "";
|
||||
this.state.resModelDescription = "";
|
||||
this.state.typeLabel = this._typeLabel(newType);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ export class PropertyDefinition extends Component {
|
||||
* @param {string} direction, either 'up' or 'down'
|
||||
*/
|
||||
onPropertyMove(direction) {
|
||||
if (direction === 'up') {
|
||||
if (direction === "up") {
|
||||
this.state.propertyIndex--;
|
||||
} else {
|
||||
this.state.propertyIndex++;
|
||||
@@ -322,7 +322,7 @@ export class PropertyDefinition extends Component {
|
||||
return;
|
||||
}
|
||||
this.state.resModelDescription = result[0].display_name;
|
||||
} catch (_) {
|
||||
} catch {
|
||||
// can not read the ir.model
|
||||
this.state.resModelDescription = sprintf(
|
||||
_lt('You do not have access to the model "%s".'),
|
||||
|
||||
@@ -1649,7 +1649,7 @@ class DynamicList extends DataPoint {
|
||||
await Promise.all(validSelection.map((record) => record.load()));
|
||||
record.switchMode("readonly");
|
||||
this.model.notify();
|
||||
} catch (_) {
|
||||
} catch {
|
||||
record.discard();
|
||||
}
|
||||
validSelection.forEach((record) => {
|
||||
|
||||
@@ -15,7 +15,16 @@ import { ActionDialog } from "./action_dialog";
|
||||
import { CallbackRecorder } from "./action_hook";
|
||||
import { ReportAction } from "./reports/report_action";
|
||||
|
||||
import { Component, markup, onMounted, onWillUnmount, onError, useChildSubEnv, xml, reactive } from "@odoo/owl";
|
||||
import {
|
||||
Component,
|
||||
markup,
|
||||
onMounted,
|
||||
onWillUnmount,
|
||||
onError,
|
||||
useChildSubEnv,
|
||||
xml,
|
||||
reactive,
|
||||
} from "@odoo/owl";
|
||||
|
||||
const actionHandlersRegistry = registry.category("action_handlers");
|
||||
const actionRegistry = registry.category("actions");
|
||||
@@ -194,7 +203,7 @@ function makeActionManager(env) {
|
||||
function _preprocessAction(action, context = {}) {
|
||||
try {
|
||||
action._originalAction = JSON.stringify(action);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// do nothing, the action might simply not be serializable
|
||||
}
|
||||
action.context = makeContext([context, action.context], env.services.user.context);
|
||||
@@ -1270,7 +1279,7 @@ function makeActionManager(env) {
|
||||
// warning: quotes and double quotes problem due to json and xml clash
|
||||
// maybe we should force escaping in xml or do a better parse of the args array
|
||||
additionalArgs = JSON.parse(params.args.replace(/'/g, '"'));
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
browser.console.error("Could not JSON.parse arguments", params.args);
|
||||
}
|
||||
args = args.concat(additionalArgs);
|
||||
|
||||
@@ -44,13 +44,13 @@ function runTestSet(assert, testSet, options) {
|
||||
let res2;
|
||||
try {
|
||||
res1 = options.newFn(input);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// continue
|
||||
}
|
||||
|
||||
try {
|
||||
res2 = options.legacyFn(input);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// continue
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ QUnit.test("trigger an error when response has 'error' key", async (assert) => {
|
||||
});
|
||||
try {
|
||||
await env.services.rpc("/test/");
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
assert.ok(true);
|
||||
}
|
||||
unpatch(browser, "mock.xhr");
|
||||
@@ -234,7 +234,7 @@ QUnit.test("check trigger RPC:REQUEST and RPC:RESPONSE for a rpc with an error",
|
||||
});
|
||||
try {
|
||||
await env.services.rpc("/test/");
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
assert.ok(true);
|
||||
}
|
||||
assert.strictEqual(rpcIdsRequest.toString(), rpcIdsResponse.toString());
|
||||
|
||||
@@ -107,13 +107,13 @@ export function makeMockXHR(response, sendCb, def) {
|
||||
if (typeof data === "string") {
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
try {
|
||||
await sendCb.call(this, data);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
listener = this._errorListener;
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ export function makeMockFetch(mockRPC) {
|
||||
try {
|
||||
res = await _rpc(route, params);
|
||||
status = 200;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
status = 500;
|
||||
}
|
||||
const blob = new Blob([JSON.stringify(res || {})], { type: "application/json" });
|
||||
|
||||
@@ -8689,7 +8689,7 @@ QUnit.module('Legacy basic_fields', {
|
||||
var left = $progressBarEl.offset().left + 5;
|
||||
try {
|
||||
testUtils.dom.triggerPositionalMouseEvent(left, top, "click");
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
form.destroy();
|
||||
$view.remove();
|
||||
throw new Error('The test fails to simulate a click in the screen. Your screen is probably too small or your dev tools is open.');
|
||||
@@ -8736,7 +8736,7 @@ QUnit.module('Legacy basic_fields', {
|
||||
var left = $progressBarEl.offset().left + 5;
|
||||
try {
|
||||
testUtils.dom.triggerPositionalMouseEvent(left, top, "click");
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
form.destroy();
|
||||
$view.remove();
|
||||
throw new Error('The test fails to simulate a click in the screen. Your screen is probably too small or your dev tools is open.');
|
||||
|
||||
@@ -114,7 +114,7 @@ QUnit.module("Legacy MockServer", {
|
||||
args: [],
|
||||
kwargs: {},
|
||||
});
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
assert.step("name_get failed")
|
||||
}
|
||||
assert.verifySteps(["name_get failed"])
|
||||
@@ -166,7 +166,7 @@ QUnit.module("Legacy MockServer", {
|
||||
args: [11111],
|
||||
kwargs: {},
|
||||
});
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
assert.step("name_get failed")
|
||||
}
|
||||
assert.verifySteps(["name_get failed"])
|
||||
|
||||
@@ -247,7 +247,7 @@ odoo.define('web.basic_model_tests', function (require) {
|
||||
try {
|
||||
await model.load(this.params);
|
||||
}
|
||||
catch (_e) {
|
||||
catch {
|
||||
assert.ok("load should return a rejected deferred for an invalid id");
|
||||
}
|
||||
|
||||
|
||||
@@ -5630,7 +5630,7 @@ QUnit.module('LegacyViews', {
|
||||
try {
|
||||
await testUtils.dom.click(kanban.$('.o_kanban_record:contains(yop) button[data-name="toggle_action"]'));
|
||||
assert.strictEqual(true, true, 'Everything went fine');
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
assert.strictEqual(true, false, 'Error triggered at action execution');
|
||||
}
|
||||
kanban.destroy();
|
||||
|
||||
@@ -198,7 +198,7 @@ QUnit.module("MockServer", (hooks) => {
|
||||
args: [],
|
||||
kwargs: {},
|
||||
});
|
||||
} catch (_) {
|
||||
} catch {
|
||||
assert.step("name_get failed");
|
||||
}
|
||||
assert.verifySteps(["name_get failed"]);
|
||||
@@ -246,7 +246,7 @@ QUnit.module("MockServer", (hooks) => {
|
||||
args: [11111],
|
||||
kwargs: {},
|
||||
});
|
||||
} catch (_) {
|
||||
} catch {
|
||||
assert.step("name_get failed");
|
||||
}
|
||||
assert.verifySteps(["name_get failed"]);
|
||||
|
||||
@@ -34,12 +34,12 @@ QUnit.module("GroupBy Class", {}, () => {
|
||||
assert.expect(3);
|
||||
try {
|
||||
getGroupBy(":day");
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
assert.step("Error 1");
|
||||
}
|
||||
try {
|
||||
getGroupBy("diay_name:yar");
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
assert.step("Error 2");
|
||||
}
|
||||
assert.verifySteps(["Error 1", "Error 2"]);
|
||||
@@ -56,22 +56,22 @@ QUnit.module("GroupBy Class", {}, () => {
|
||||
assert.expect(5);
|
||||
try {
|
||||
getGroupBy("", fields);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
assert.step("Error 1");
|
||||
}
|
||||
try {
|
||||
getGroupBy("display_name:day", fields);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
assert.step("Error 2");
|
||||
}
|
||||
try {
|
||||
getGroupBy("diay_name:year", fields);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
assert.step("Error 3");
|
||||
}
|
||||
try {
|
||||
getGroupBy("diay_name:yar", fields);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
assert.step("Error 4");
|
||||
}
|
||||
assert.verifySteps(["Error 1", "Error 2", "Error 3", "Error 4"]);
|
||||
@@ -91,7 +91,7 @@ QUnit.module("GroupBy Class", {}, () => {
|
||||
assert.expect(2);
|
||||
try {
|
||||
getGroupBy("date_field:yar", fields);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
assert.step("Error");
|
||||
}
|
||||
assert.verifySteps(["Error"]);
|
||||
|
||||
@@ -253,7 +253,7 @@ QUnit.module("ActionManager", (hooks) => {
|
||||
await doAction(webClient, 7);
|
||||
try {
|
||||
await doAction(webClient, 7);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
assert.step("error caught");
|
||||
}
|
||||
assert.verifySteps([
|
||||
|
||||
@@ -284,7 +284,7 @@ export class ImageSelector extends FileSelector {
|
||||
media.dynamicColors = dynamicColors;
|
||||
}
|
||||
}
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
console.error('CORS is misconfigured on the API server, image will be treated as non-dynamic.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ var FieldHtml = basic_fields.DebouncedField.extend(DynamicPlaceholderFieldMixin)
|
||||
var cwindow = self.$iframe[0].contentWindow;
|
||||
try {
|
||||
cwindow.document;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
cwindow.document
|
||||
@@ -494,7 +494,7 @@ var FieldHtml = basic_fields.DebouncedField.extend(DynamicPlaceholderFieldMixin)
|
||||
var value = text || "";
|
||||
try {
|
||||
$(text)[0].innerHTML; // crashes if text isn't html
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
if (value.match(/^\s*$/)) {
|
||||
value = '<p><br/></p>';
|
||||
} else {
|
||||
|
||||
@@ -409,7 +409,7 @@ export class HtmlField extends Component {
|
||||
const cwindow = this.iframeRef.el.contentWindow;
|
||||
try {
|
||||
cwindow.document;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
cwindow.document
|
||||
|
||||
@@ -35,7 +35,7 @@ return {
|
||||
// document.styleSheets[].cssRules[] for cross-domain
|
||||
// stylesheets.
|
||||
rules = sheets[i].rules || sheets[i].cssRules;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (!rules) {
|
||||
|
||||
@@ -125,7 +125,7 @@ const _DialogLinkWidget = Link.extend({
|
||||
const Url = URL || window.URL || window.webkitURL;
|
||||
const urlObj = url.startsWith('/') ? new Url(url, window.location.origin) : new Url(url);
|
||||
return (urlObj.origin !== window.location.origin);
|
||||
} catch (_ignored) {
|
||||
} catch {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -174,7 +174,7 @@ const LinkPopoverWidget = Widget.extend({
|
||||
}
|
||||
try {
|
||||
url = new URL(this.target.href); // relative to absolute
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// Invalid URL, might happen with editor unsuported protocol. eg type
|
||||
// `geo:37.786971,-122.399677`, become `http://geo:37.786971,-122.399677`
|
||||
this.displayNotification({
|
||||
|
||||
@@ -129,7 +129,7 @@ const wSnippetMenu = weSnippetEditor.SnippetsMenu.extend({
|
||||
class: 'ms-1',
|
||||
}));
|
||||
}
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
$apiKeyHelp.text(_t("Check your connection and try again"));
|
||||
} finally {
|
||||
$button.prop("disabled", false);
|
||||
@@ -377,7 +377,7 @@ const wSnippetMenu = weSnippetEditor.SnippetsMenu.extend({
|
||||
try {
|
||||
range.surroundContents(animatedTextEl);
|
||||
$snippet = $(animatedTextEl);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// This try catch is needed because 'surroundContents' may
|
||||
// fail when the range has partially selected a non-Text node.
|
||||
if (range.commonAncestorContainer.textContent === range.toString()) {
|
||||
|
||||
@@ -284,7 +284,7 @@ options.registry.SocialMedia = options.Class.extend({
|
||||
const iconNames = fonts.fontIcons[0].alias;
|
||||
const exactIcon = iconNames.find(el => el === `fa-${domain}`);
|
||||
return (exactIcon || iconNames.find(el => el.includes(domain))).split('fa-').pop();
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -317,7 +317,7 @@ options.registry.SocialMedia = options.Class.extend({
|
||||
let url;
|
||||
try {
|
||||
url = new URL(str);
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
return url.protocol.startsWith('http');
|
||||
|
||||
@@ -444,7 +444,7 @@ odoo.define('website.s_website_form', function (require) {
|
||||
try {
|
||||
this.parse_date(value, type_of_date);
|
||||
return true;
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ publicWidget.registry.websiteEventSearchSponsor = publicWidget.Widget.extend({
|
||||
const ids = JSON.parse(params.get(name));
|
||||
params.set(name, JSON.stringify(ids.filter(id => id !== data.value)));
|
||||
this.form.attr('action', `${window.location.href.split('?')[0]}?${params.toString()}`);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"no-unsafe-negation": ["error"],
|
||||
"no-duplicate-imports": ["error"],
|
||||
"valid-typeof": ["error"],
|
||||
"no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false, "caughtErrors": "all", "caughtErrorsIgnorePattern": "^_" }]
|
||||
"no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false, "caughtErrors": "all" }]
|
||||
},
|
||||
"globals": {
|
||||
"owl": "readonly",
|
||||
|
||||
Reference in New Issue
Block a user