mirror of
https://github.com/grafana/grafana.git
synced 2026-07-29 15:59:50 -05:00
Explore: handle URLs parse errors (#77784)
* Explore: handle URLs parse errors * minor modifications * tentative fix * update docs * omit v0 params from the final url * Apply suggestions from code review Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com> * remove safeParseJson, make parse return an object --------- Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
This commit is contained in:
co-authored by
Piotr Jamróz
parent
b56d7131bd
commit
53642b60ed
@@ -148,18 +148,6 @@ export function buildQueryTransaction(
|
||||
|
||||
export const clearQueryKeys: (query: DataQuery) => DataQuery = ({ key, ...rest }) => rest;
|
||||
|
||||
export const safeParseJson = (text?: string): any | undefined => {
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
return JSON.parse(text);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const safeStringifyValue = (value: unknown, space?: number) => {
|
||||
if (value === undefined || value === null) {
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user