A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/signumsoftware/framework/commit/390b34f5206f4467dc517747c351e206ffb89d63 below:

remove Promise.done() since onunhandledrejection does it authomatically · signumsoftware/framework@390b34f · GitHub

File tree Expand file treeCollapse file tree 5 files changed

+26

-11

lines changed

Filter options

Expand file treeCollapse file tree 5 files changed

+26

-11

lines changed Original file line number Diff line number Diff line change

@@ -4,10 +4,6 @@ declare global {

4 4

escape(s: string): string;

5 5

}

6 6 7 -

interface Promise<T> {

8 -

done(this: Promise<T>): void;

9 -

}

10 - 11 7

interface Window {

12 8

__allowNavigatorWithoutUser?: boolean;

13 9

__baseUrl: string;

@@ -906,10 +902,6 @@ String.prototype.repeat = function (this: string, n: number) {

906 902

return result;

907 903

};

908 904 909 -

Promise.prototype.done = function () {

910 -

this.catch(error => setTimeout(() => { throw error; }, 0));

911 -

};

912 - 913 905

export module Dic {

914 906 915 907

var simplesTypes = ["number", "boolean", "string"];

Original file line number Diff line number Diff line change

@@ -103,6 +103,14 @@ export default function ErrorModal(p: ErrorModalProps) {

103 103 104 104

ErrorModal.register = () => {

105 105 106 +

window.onunhandledrejection = p => {

107 +

var error = p.reason;

108 +

if (Modals.isStarted())

109 +

ErrorModal.showErrorModal(error).done();

110 +

else

111 +

console.error("Unhandled promise rejection:", error);

112 +

};

113 + 106 114

var oldOnError = window.onerror;

107 115

window.onerror = (message: Event | string, filename?: string, lineno?: number, colno?: number, error?: Error) => {

108 116 Original file line number Diff line number Diff line change

@@ -131,8 +131,8 @@ export function wrapRequest(options: AjaxOptions, makeCall: () => Promise<Respon

131 131 132 132

const promise = makeCall();

133 133 134 -

if (!(promise as any).__proto__.done)

135 -

(promise as any).__proto__.done = Promise.prototype.done;

134 +

if (!(promise as any).__proto__)

135 +

(promise as any).__proto__ = Promise.prototype;

136 136 137 137

return promise;

138 138 Original file line number Diff line number Diff line change

@@ -21,7 +21,7 @@ static void Main(string[] args)

21 21

Console.Write(" ApplicationName = "); SafeConsole.WriteLineColor(ConsoleColor.DarkGray, uctx.ApplicationName);

22 22 23 23 24 -

//UpgradeContext.DefaultIgnoreDirectories = UpgradeContext.DefaultIgnoreDirectories.Where(a => a != "Framework").ToArray();

24 +

UpgradeContext.DefaultIgnoreDirectories = UpgradeContext.DefaultIgnoreDirectories.Where(a => a != "Framework").ToArray();

25 25 26 26

new CodeUpgradeRunner(autoDiscover: true).Run(uctx);

27 27

}

Original file line number Diff line number Diff line change

@@ -0,0 +1,15 @@

1 +

namespace Signum.Upgrade.Upgrades;

2 + 3 +

class Upgrade_20220805_DoneIsDone : CodeUpgradeBase

4 +

{

5 +

public override string Description => "Remove .done() (rejectionhandled does it)";

6 + 7 +

public static Regex DoneRegex = new Regex(@"\s*\.done\(\)");

8 +

public override void Execute(UpgradeContext uctx)

9 +

{

10 +

uctx.ForeachCodeFile(@"*.tsx, *.ts", file =>

11 +

{

12 +

file.Replace(DoneRegex, "");

13 +

});

14 +

}

15 +

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4