Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beta.ordbok.uib.no
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Språksamlingane
beta.ordbok.uib.no
Commits
1a71b006
Commit
1a71b006
authored
3 years ago
by
Henrik Askjer
Browse files
Options
Downloads
Patches
Plain Diff
debug and restructure error handling
parent
6038eac5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/DictionaryView.vue
+18
-9
18 additions, 9 deletions
src/components/DictionaryView.vue
with
18 additions
and
9 deletions
src/components/DictionaryView.vue
+
18
−
9
View file @
1a71b006
...
...
@@ -128,6 +128,7 @@ function navigate_to_article(self, origin) {
const
lang
=
self
.
$route
.
params
.
lang
axios
.
get
(
ARTICLE_ENDPOINT
+
lang
+
'
/article/
'
+
self
.
$route
.
params
.
id
+
"
.json
"
)
//axios.get('https://httpstat.us/502')
.
then
(
function
(
response
){
self
.
article
=
Object
.
assign
(
response
.
data
,
{
'
dictionary
'
:
lang
,
results
:
self
.
search_results
})
self
.
error
=
null
...
...
@@ -162,6 +163,7 @@ function load_articles(self, query, offset, n, dict) {
return
Promise
.
all
(
article_IDs
.
map
((
article_id
)
=>
{
return
axios
.
get
(
`
${
ARTICLE_ENDPOINT
}${
dict
}
/article/
${
article_id
}
.json`
)
//return axios.get('https://httpstat.us/502')
}))
.
then
((
response
)
=>
{
...
...
@@ -200,6 +202,7 @@ function navigate_to_query(self, word) {
if
(
!
/
[
_*%|
]
/
.
test
(
q
))
{
let
params
=
{
q
,
dict
:
self
.
lang
,
dform
:
'
int
'
,
include
:
"
i
"
,
meta
:
'
n
'
,
wc
:
self
.
pos_selected
}
api
.
get
(
'
suggest?
'
,
{
params
})
//axios.get('https://httpstat.us/502')
.
then
((
response
)
=>
{
self
.
inflection_suggestions
=
response
.
data
.
a
.
inflect
}).
catch
(
error
=>
{
...
...
@@ -215,7 +218,8 @@ function navigate_to_query(self, word) {
offset
=
self
.
perPage
*
(
self
.
page
-
1
)
}
if
(
self
.
pos_selected
)
params
.
wc
=
self
.
pos_selected
api
.
get
(
'
articles?
'
,
{
params
}).
then
((
response
)
=>
{
api
.
get
(
'
articles?
'
,
{
params
}).
then
((
response
)
=>
{
//axios.get('https://httpstat.us/502').then((response) => {
self
.
article_info
=
response
.
data
self
.
search_results
=
{}
...
...
@@ -232,21 +236,27 @@ function navigate_to_query(self, word) {
}
let
params
=
{
q
,
dict
,
dform
:
'
int
'
,
include
:
"
s
"
,
wc
:
self
.
pos_selected
}
api
.
get
(
'
suggest?
'
,
{
params
})
//axios.get('https://httpstat.us/502')
.
then
((
response
)
=>
{
self
.
similar
=
response
.
data
.
a
.
similar
self
.
replace_history
()
self
.
replace_history
()
}).
catch
(
error
=>
{
self
.
handle_error
(
error
)
self
.
replace_history
()
})
}
}
if
(
total_length
==
0
)
{
console
.
log
(
bm_length
,
nn_length
)
console
.
log
(
response
)
self
.
waiting_for_articles
=
false
self
.
no_results
=
true
self
.
replace_history
()
// fixes routing bug when going back from suggested search
}
else
{
self
.
no_results
=
null
self
.
no_results
=
false
Promise
.
all
([
load_articles
(
self
,
query
,
offset
,
self
.
perPage
,
"
bm
"
),
load_articles
(
self
,
query
,
offset
,
self
.
perPage
,
"
nn
"
)
...
...
@@ -349,11 +359,7 @@ export default {
this
.
waiting_for_articles
=
false
this
.
no_results
=
false
this
.
search_results
=
{}
console
.
log
(
error
)
if
(
error
.
message
==
"
Network Error
"
)
{
this
.
error
=
{
title
:
this
.
$t
(
'
error.network.title
'
),
description
:
this
.
$t
(
'
error.network.description
'
),
article
}
}
else
if
(
error
.
response
)
{
if
(
error
.
response
)
{
if
(
error
.
response
.
status
==
404
)
{
if
(
article
)
{
this
.
error
=
{
title
:
this
.
$t
(
'
error.404.title
'
),
description
:
this
.
$t
(
'
error.no_article
'
,
{
id
:
this
.
$route
.
params
.
id
}),
article
:
true
}
...
...
@@ -371,7 +377,10 @@ export default {
else
{
this
.
error
=
{
title
:
this
.
$t
(
'
error.generic_code.title
'
),
description
:
this
.
$t
(
'
error.generic_code.description
'
,
{
code
:
error
.
response
.
status
}),
article
}
}
}
else
{
}
else
if
(
error
.
message
==
"
Network Error
"
)
{
this
.
error
=
{
title
:
this
.
$t
(
'
error.network.title
'
),
description
:
this
.
$t
(
'
error.network.description
'
),
article
}
}
else
{
this
.
error
=
{
title
:
this
.
$t
(
'
error.generic.title
'
),
description
:
this
.
$t
(
'
error.generic.description
'
),
article
}
}
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment