error mng improvement

pull/37/head
Niko PLP 2 months ago
parent 00398272bd
commit 148838aada
  1. 2
      ng-app/index-web.html
  2. 11
      ng-app/src/apps/SparqlQueryEditor.svelte
  3. 3
      ng-app/src/apps/SparqlUpdateEditor.svelte
  4. 5
      ng-app/src/apps/TurtleViewer.svelte
  5. 5
      ng-app/src/lib/panes/Files.svelte
  6. 3
      ng-app/src/locales/en.json
  7. 2
      ng-app/src/store.ts
  8. 6
      ng-oxigraph/src/oxigraph/sparql/dataset.rs
  9. 12
      ng-sdk-js/src/lib.rs
  10. 2
      ng-verifier/src/request_processor.rs

@ -87,7 +87,7 @@
</svg> </svg>
<br/> <br/>
<div id="error-no-wasm" class="error-no-wasm-hidden" style="text-align: center;"> <div id="error-no-wasm" class="error-no-wasm-hidden" style="text-align: center;">
Your browser is too old and does not support NextGraph. <br/>Please upgrade to a newer version of this browser,<br/> try with another browser, <br/>or <a href="https://nextgraph.org/install">install our native app</a>. Your browser is too old and does not support NextGraph. <br/>Please upgrade to a newer version of this browser,<br/> try with another browser, <br/>or <a href="https://nextgraph.org/download">install our native app</a>.
</div> </div>
<noscript style="text-align: center;"> <noscript style="text-align: center;">
NextGraph cannot load as Javascript is deactivated NextGraph cannot load as Javascript is deactivated

@ -15,7 +15,8 @@
sparql_query, sparql_query,
toast_error, toast_error,
toast_success, toast_success,
reset_toasts reset_toasts,
display_error,
} from "../store"; } from "../store";
import { import {
in_memory_discrete, open_viewer, set_viewer, reset_in_memory in_memory_discrete, open_viewer, set_viewer, reset_in_memory
@ -54,7 +55,7 @@
reset_toasts(); reset_toasts();
results = await sparql_query($in_memory_discrete, union); results = await sparql_query($in_memory_discrete, union);
} catch(e) { } catch(e) {
toast_error(e); toast_error(display_error(e));
} }
} }
const openTurtle = () => { const openTurtle = () => {
@ -92,9 +93,13 @@
<div> <div>
<span class="ml-2 font-bold">Results: <br/></span> <span class="ml-2 font-bold">Results: <br/></span>
{#if Array.isArray(results)} {#if Array.isArray(results)}
<Highlight {language} code={results.join(" .\r\n") + " ."} class="mb-10" let:highlighted > {#if results.length}
<Highlight {language} code={results.join(" .\r\n") + (results.length ? " .":"")} class="mb-10" let:highlighted >
<LineNumbers {highlighted} wrapLines hideBorder /> <LineNumbers {highlighted} wrapLines hideBorder />
</Highlight> </Highlight>
{:else}
Empty
{/if}
{:else if results?.head} {:else if results?.head}
<Table> <Table>
<TableHead> <TableHead>

@ -16,6 +16,7 @@
toast_error, toast_error,
toast_success, toast_success,
reset_toasts, reset_toasts,
display_error,
} from "../store"; } from "../store";
import { import {
in_memory_discrete, open_viewer, reset_in_memory in_memory_discrete, open_viewer, reset_in_memory
@ -41,7 +42,7 @@
await sparql_update($in_memory_discrete); await sparql_update($in_memory_discrete);
toast_success($t("app.sparql_update_editor.success")); toast_success($t("app.sparql_update_editor.success"));
} catch(e) { } catch(e) {
toast_error(e); toast_error(display_error(e));
} }
} }
const openViewer = () => { const openViewer = () => {

@ -36,7 +36,7 @@
export let commits = {graph:[]}; export let commits = {graph:[]};
let source = ""; let source = "";
$: source = commits.graph.join(" .\r\n") + " ."; $: source = commits.graph.join(" .\r\n") + (commits.graph.length ? " .":"");
const openQuery = () => { const openQuery = () => {
set_viewer("n:g:z:sparql_query"); set_viewer("n:g:z:sparql_query");
@ -72,10 +72,11 @@
</button> </button>
{/if} {/if}
{#if source}
<Highlight {language} code={source} class="mb-10" let:highlighted > <Highlight {language} code={source} class="mb-10" let:highlighted >
<LineNumbers {highlighted} wrapLines hideBorder /> <LineNumbers {highlighted} wrapLines hideBorder />
</Highlight> </Highlight>
{/if}
</div> </div>

@ -156,7 +156,6 @@
object: reference.V0.FileUploaded, object: reference.V0.FileUploaded,
}, },
}; };
await ng.app_request_with_nuri_command(nuri, "FilePut", $active_session.session_id, file_put_payload); await ng.app_request_with_nuri_command(nuri, "FilePut", $active_session.session_id, file_put_payload);
} }
}); });
@ -167,6 +166,7 @@
<div class="w-full"> <div class="w-full">
{#if $cur_tab.doc.can_edit}
<div class="row pt-2 w-full"> <div class="row pt-2 w-full">
<Button <Button
@ -187,6 +187,7 @@
bind:this={fileinput} bind:this={fileinput}
/> />
</div> </div>
{/if}
{#if upload_progress !== null} {#if upload_progress !== null}
<div class="mx-6 mt-2"> <div class="mx-6 mt-2">
<Progressbar <Progressbar
@ -224,7 +225,7 @@
target="_blank" target="_blank"
download={file.name} download={file.name}
></a> ></a>
<button class="ml-2 select-none p-1 pb-0 text-gray-600" style="box-shadow:none;" on:click={()=>download(file)}> <button class="ml-2 select-none p-1 pb-0 pt-0 text-gray-600" style="box-shadow:none;" on:click={()=>download(file)}>
<span><ArrowDownTray tabindex="-1" class="w-6 h-8 mr-3 focus:outline-none" style="display:inline"/>{$t("doc.file.download")}</span> <span><ArrowDownTray tabindex="-1" class="w-6 h-8 mr-3 focus:outline-none" style="display:inline"/>{$t("doc.file.download")}</span>
</button> </button>
{/if} {/if}

@ -551,7 +551,8 @@
"NotARendezVous": "You scanned an invalid QR-Code.", "NotARendezVous": "You scanned an invalid QR-Code.",
"camera_unavailable": "Camera is unavailable.", "camera_unavailable": "Camera is unavailable.",
"ServerAlreadyRunningInOtherProcess": "App is already running on this device. Check it and close it.", "ServerAlreadyRunningInOtherProcess": "App is already running on this device. Check it and close it.",
"cannot_load_this_file": "Cannot load this file" "cannot_load_this_file": "Cannot load this file",
"graph_not_found": "Graph not found"
}, },
"connectivity": { "connectivity": {
"stopped": "Stopped", "stopped": "Stopped",

@ -45,7 +45,7 @@ init({
}); });
export const display_error = (error: string) => { export const display_error = (error: string) => {
console.log(error); //console.log(error);
// TODO: Check, if error tranlsation does not exist // TODO: Check, if error tranlsation does not exist
const parts = error.split(":"); const parts = error.split(":");
let res = get(format)("errors." + parts[0]); let res = get(format)("errors." + parts[0]);

@ -72,9 +72,9 @@ impl DatasetView {
fn parse_graph_name(&self, graph_name: &EncodedTerm) -> Result<MatchBy, StorageError> { fn parse_graph_name(&self, graph_name: &EncodedTerm) -> Result<MatchBy, StorageError> {
match graph_name { match graph_name {
EncodedTerm::NamedNode { iri_id } => { EncodedTerm::NamedNode { iri_id } => {
let graph_name_string = self.get_str(iri_id)?.ok_or::<StorageError>( let graph_name_string = self
CorruptionError::msg("graph_name not found in parse_graph_name").into(), .get_str(iri_id)?
)?; .ok_or::<StorageError>(CorruptionError::msg("graph_not_found").into())?;
self.reader self.reader
.parse_graph_name(&graph_name_string, Some(*iri_id)) .parse_graph_name(&graph_name_string, Some(*iri_id))
} }

@ -938,9 +938,9 @@ async fn app_request_stream_(
Ok(promise) => match JsFuture::from(promise).await { Ok(promise) => match JsFuture::from(promise).await {
Ok(js_value) => { Ok(js_value) => {
if js_value == JsValue::TRUE { if js_value == JsValue::TRUE {
log_debug!("cancel because true"); //log_debug!("cancel because true");
reader.close(); reader.close();
canceller_tx.send(()).await; let _ = canceller_tx.send(()).await;
canceller_tx.close_channel(); canceller_tx.close_channel();
break; break;
} }
@ -949,9 +949,9 @@ async fn app_request_stream_(
}, },
Err(returned_val) => { Err(returned_val) => {
if returned_val == JsValue::TRUE { if returned_val == JsValue::TRUE {
log_debug!("cancel because true"); //log_debug!("cancel because true");
reader.close(); reader.close();
canceller_tx.send(()).await; let _ = canceller_tx.send(()).await;
canceller_tx.close_channel(); canceller_tx.close_channel();
break; break;
} }
@ -968,7 +968,7 @@ async fn app_request_stream_(
async fn inner_canceller(mut canceller_rx: Receiver<()>, cancel: CancelFn) -> ResultSend<()> { async fn inner_canceller(mut canceller_rx: Receiver<()>, cancel: CancelFn) -> ResultSend<()> {
if let Some(_) = canceller_rx.next().await { if let Some(_) = canceller_rx.next().await {
log_info!("cancelling"); //log_info!("cancelling");
cancel(); cancel();
} }
Ok(()) Ok(())
@ -981,7 +981,7 @@ async fn app_request_stream_(
let cb = Closure::once(move || { let cb = Closure::once(move || {
log_info!("trying to cancel"); log_info!("trying to cancel");
//sender.close_channel() //sender.close_channel()
canceller_tx.unbounded_send(()); let _ = canceller_tx.unbounded_send(());
canceller_tx.close_channel(); canceller_tx.close_channel();
}); });
//Closure::wrap(Box::new(move |sender| sender.close_channel()) as Box<FnMut(Sender<Commit>)>); //Closure::wrap(Box::new(move |sender| sender.close_channel()) as Box<FnMut(Sender<Commit>)>);

@ -109,7 +109,7 @@ impl Verifier {
spawn_and_log_error(sending_loop(Arc::new(file), tx.clone())); spawn_and_log_error(sending_loop(Arc::new(file), tx.clone()));
let fnonce = Box::new(move || { let fnonce = Box::new(move || {
log_debug!("FileGet cancelled"); //log_debug!("FileGet cancelled");
tx.close_channel(); tx.close_channel();
}); });
Ok((rx, fnonce)) Ok((rx, fnonce))

Loading…
Cancel
Save