File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 5858 . replace ( / \/ b l o b \/ / , '/' ) . replace ( / \/ r a w \/ / , '/' ) ;
5959 } ;
6060
61+ /**
62+ * Reports an error directly in HTML.
63+ * @param {string } msg - The error message to be reported to the user.
64+ * @returns {void }
65+ */
66+ const reportError = function ( msg ) {
67+ const errP = document . createElement ( 'p' ) ;
68+ errP . innerHTML = msg ;
69+ document . body . appendChild ( errP ) ;
70+ throw new SyntaxError ( msg ) ;
71+ } ;
72+
6173 /**
6274 * If the first parameter is a URL to a file on a known git forge,
6375 * returns the URL to the raw version of this file
7385 const params = new URLSearchParams ( location . search ) ;
7486 const previewFileUrl = params . get ( 'url' ) ;
7587 if ( previewFileUrl === null ) {
76- const errP = document . createElement ( 'p' ) ;
77- errP . innerHTML = 'Please use "...?url=..." vs the old "...?..."!' ;
78- document . body . appendChild ( errP ) ;
79- throw new SyntaxError ( 'Missing required parameter "url"!' ) ;
88+ reportError ( 'Missing required parameter "url"' ) ;
8089 }
8190
8291 return rawifyForgeUrl ( previewFileUrl ) ;
You can’t perform that action at this time.
0 commit comments