-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathLogException.vue
More file actions
74 lines (62 loc) · 1.78 KB
/
LogException.vue
File metadata and controls
74 lines (62 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!--
SPDX-FileCopyrightText: 2023 Nextcloud Gmbh and Nextcloud contributors
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<span class="exception_wrapper">
<div class="exception">
<span class="exception__title">
{{ exceptionTitleText }}
</span>
<span class="exception__message">{{ exceptionMessage }}</span>
</div>
<StackTrace v-if="props.isExpanded" :trace="props.exception.Trace" class="exception__trace" />
<LogException v-if="props.isExpanded && props.exception.Previous" :isPrevious="true" :exception="props.exception.Previous" />
</span>
</template>
<script setup lang="ts">
import type { IException } from '../../interfaces'
import { translate as t } from '@nextcloud/l10n'
import { computed } from 'vue'
import StackTrace from './StackTrace.vue'
const props = withDefaults(defineProps<{
isPrevious: boolean
isExpanded: boolean
exception: IException
}>(), {
isExpanded: false,
isPrevious: false,
})
/**
* The name of the exception class, e.g. 'GenericFileException'
*/
const exceptionName = computed(() => props.exception.Exception.split('\\').pop() || '?')
const exceptionMessage = computed(() => props.exception.Message && props.exception.Message !== '--' ? props.exception.Message : props.exception.CustomMessage)
/**
* Text to show on the title, handle also nested exceptions
*/
const exceptionTitleText = computed(() => {
if (props.isPrevious) {
return t('logreader', 'Caused by {exception}', { exception: exceptionName.value })
}
return exceptionName.value
})
</script>
<style lang="scss" scoped>
.exception {
display: flex;
align-items: start;
&__title {
font-weight: bold;
white-space: normal;
}
&__message {
margin-inline-start: 6px;
overflow: hidden;
text-overflow: ellipsis;
}
&__trace {
margin-inline-start: 2em;
}
}
</style>