mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] *: move OwlError to common
This commit moves OwlError to its own file in the new common folder such that it is no longer associated with the runtime.
This commit is contained in:
committed by
Géry Debongnie
parent
9b1c270501
commit
9b1ec5dc0e
@@ -0,0 +1,4 @@
|
||||
// Custom error class that wraps error that happen in the owl lifecycle
|
||||
export class OwlError extends Error {
|
||||
cause?: any;
|
||||
}
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
Attrs,
|
||||
EventHandlers,
|
||||
} from "./parser";
|
||||
import { OwlError } from "../runtime/error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
|
||||
type BlockType = "block" | "text" | "multi" | "list" | "html" | "comment";
|
||||
const whitespaceRE = /\s+/g;
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { TemplateSet } from "../runtime/template_set";
|
||||
import type { BDom } from "../runtime/blockdom";
|
||||
import { CodeGenerator, Config } from "./code_generator";
|
||||
import { parse } from "./parser";
|
||||
import { OwlError } from "../runtime";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
|
||||
export type Template = (context: any, vnode: any, key?: string) => BDom;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OwlError } from "../runtime/error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
|
||||
/**
|
||||
* Owl QWeb Expression Parser
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OwlError } from "../runtime/error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// AST Type definition
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
import { version } from "../version";
|
||||
import { Component, ComponentConstructor, Props } from "./component";
|
||||
import { ComponentNode } from "./component_node";
|
||||
import { nodeErrorHandlers, OwlError, handleError } from "./error_handling";
|
||||
import { nodeErrorHandlers, handleError } from "./error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
import { Fiber, RootFiber, MountOptions } from "./fibers";
|
||||
import { Scheduler } from "./scheduler";
|
||||
import { validateProps } from "./template_helpers";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OwlError } from "../error_handling";
|
||||
import { OwlError } from "../../common/owl_error";
|
||||
import { attrsSetter, attrsUpdater, createAttrUpdater, setClass, updateClass } from "./attributes";
|
||||
import { config } from "./config";
|
||||
import { createEventHandler } from "./events";
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { App, Env } from "./app";
|
||||
import { BDom, VNode } from "./blockdom";
|
||||
import { Component, ComponentConstructor, Props } from "./component";
|
||||
import { fibersInError, OwlError } from "./error_handling";
|
||||
import { fibersInError } from "./error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
import { Fiber, makeChildFiber, makeRootFiber, MountFiber, MountOptions } from "./fibers";
|
||||
import { clearReactivesForCallback, getSubscriptions, reactive, targets } from "./reactivity";
|
||||
import { STATUS } from "./status";
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { OwlError } from "../common/owl_error";
|
||||
import type { ComponentNode } from "./component_node";
|
||||
import type { Fiber } from "./fibers";
|
||||
|
||||
// Custom error class that wraps error that happen in the owl lifecycle
|
||||
export class OwlError extends Error {
|
||||
cause?: any;
|
||||
}
|
||||
|
||||
// Maps fibers to thrown errors
|
||||
export const fibersInError: WeakMap<Fiber, any> = new WeakMap();
|
||||
export const nodeErrorHandlers: WeakMap<ComponentNode, ((error: any) => void)[]> = new WeakMap();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { filterOutModifiersFromData } from "./blockdom/config";
|
||||
import { STATUS } from "./status";
|
||||
import { OwlError } from "./error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
|
||||
export const mainEventHandler = (data: any, ev: Event, currentTarget?: EventTarget | null) => {
|
||||
const { data: _data, modifiers } = filterOutModifiersFromData(data);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { BDom, mount } from "./blockdom";
|
||||
import type { ComponentNode } from "./component_node";
|
||||
import { fibersInError, OwlError } from "./error_handling";
|
||||
import { fibersInError } from "./error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
import { STATUS } from "./status";
|
||||
|
||||
export function makeChildFiber(node: ComponentNode, parent: Fiber): Fiber {
|
||||
|
||||
@@ -55,7 +55,7 @@ export {
|
||||
onError,
|
||||
} from "./lifecycle_hooks";
|
||||
export { validate, validateType } from "./validation";
|
||||
export { OwlError } from "./error_handling";
|
||||
export { OwlError } from "../common/owl_error";
|
||||
|
||||
export const __info__ = {
|
||||
version: App.version,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getCurrent } from "./component_node";
|
||||
import { nodeErrorHandlers, OwlError } from "./error_handling";
|
||||
import { nodeErrorHandlers } from "./error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
|
||||
const TIMEOUT = Symbol("timeout");
|
||||
function wrapError(fn: (...args: any[]) => any, hookName: string) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { onMounted, onWillUnmount } from "./lifecycle_hooks";
|
||||
import { BDom, text, VNode } from "./blockdom";
|
||||
import { Component } from "./component";
|
||||
import { OwlError } from "./error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
|
||||
const VText: any = text("").constructor;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Callback } from "./utils";
|
||||
import { OwlError } from "./error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
|
||||
// Special key to subscribe to, to be notified of key creation/deletion
|
||||
const KEYCHANGES = Symbol("Key changes");
|
||||
|
||||
@@ -4,7 +4,7 @@ import { html } from "./blockdom/index";
|
||||
import { isOptional, validateSchema } from "./validation";
|
||||
import type { ComponentConstructor } from "./component";
|
||||
import { markRaw } from "./reactivity";
|
||||
import { OwlError } from "./error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
import type { ComponentNode } from "./component_node";
|
||||
|
||||
const ObjectCreate = Object.create;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { comment, createBlock, html, list, multi, text, toggler } from "./blockd
|
||||
import { getCurrent } from "./component_node";
|
||||
import { Portal, portalTemplate } from "./portal";
|
||||
import { helpers } from "./template_helpers";
|
||||
import { OwlError } from "./error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
|
||||
const bdom = { text, createBlock, list, multi, html, toggler, comment };
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OwlError } from "./error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
export type Callback = () => void;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OwlError } from "./error_handling";
|
||||
import { OwlError } from "../common/owl_error";
|
||||
import { toRaw } from "./reactivity";
|
||||
|
||||
type BaseType =
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
useLogLifecycle,
|
||||
nextAppError,
|
||||
} from "../helpers";
|
||||
import { OwlError } from "../../src/runtime/error_handling";
|
||||
import { OwlError } from "../../src/common/owl_error";
|
||||
|
||||
let fixture: HTMLElement;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OwlError } from "../../src/runtime/error_handling";
|
||||
import { OwlError } from "../../src/common/owl_error";
|
||||
import { App, Component, mount, onMounted, useState, xml } from "../../src";
|
||||
import { makeTestFixture, nextAppError, nextTick, snapshotEverything } from "../helpers";
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import { helpers } from "../src/runtime/template_helpers";
|
||||
import { TemplateSet, globalTemplates } from "../src/runtime/template_set";
|
||||
import { BDom } from "../src/runtime/blockdom";
|
||||
import { compile } from "../src/compiler";
|
||||
import { OwlError } from "../src/runtime/error_handling";
|
||||
import { OwlError } from "../src/common/owl_error";
|
||||
|
||||
const mount = blockDom.mount;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OwlError } from "../../src/runtime/error_handling";
|
||||
import { OwlError } from "../../src/common/owl_error";
|
||||
import {
|
||||
App,
|
||||
Component,
|
||||
|
||||
Reference in New Issue
Block a user