Skip to content

Commit

Permalink
Fix minor code tidyness issues (#123)
Browse files Browse the repository at this point in the history
Fixes #115, #116
  • Loading branch information
vogelsgesang authored Oct 19, 2024
1 parent c52a47d commit 9b7e088
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions query-graphs/src/hyper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,10 @@ function colorRelativeExecutionTime(state: ConversionState) {

// Sets the edge widths, relative to the number of output tuples
function setEdgeWidths(state: ConversionState) {
let maxWidth = state.edgeWidths.reduce((p, v) => (p > v.width ? p : v.width), 0);
const maxWidth = state.edgeWidths.reduce((p, v) => (p > v.width ? p : v.width), 0);
const minWidth = state.edgeWidths.reduce((p, v) => (p < v.width ? p : v.width), Infinity);
if (minWidth == maxWidth) return;
const factor = Math.max(maxWidth - minWidth, minWidth);
maxWidth = Math.max(maxWidth, 10);
for (const edge of state.edgeWidths) {
edge.node.edgeWidth = (edge.width - minWidth) / factor;
}
Expand Down
6 changes: 4 additions & 2 deletions query-graphs/src/xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ export function typesafeXMLParse(str: string): ParsedXML {
mergeAttrs: false,
});
parser.parseString(str, (err: unknown, parsed: ParsedXML) => {
if (err) {
throw new Error("XML parse failed with '" + err + "'.");
if (err instanceof Error) {
throw new Error("XML parse failed with '" + err.message + "'.");
} else if (err) {
throw new Error("XML parse failed.");
} else {
result = parsed;
}
Expand Down

0 comments on commit 9b7e088

Please sign in to comment.