Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor code tidyness issues #123

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading