Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
pleroma
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
339
Issues
339
List
Boards
Labels
Milestones
Merge Requests
34
Merge Requests
34
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pleroma
pleroma
Commits
a177f22e
Commit
a177f22e
authored
Oct 18, 2019
by
kaniini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
object: fetcher: improve error reporting
parent
bf210774
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
lib/pleroma/object/fetcher.ex
lib/pleroma/object/fetcher.ex
+11
-4
No files found.
lib/pleroma/object/fetcher.ex
View file @
a177f22e
...
...
@@ -66,7 +66,7 @@ defmodule Pleroma.Object.Fetcher do
{
:normalize
,
nil
}
<-
{
:normalize
,
Object
.
normalize
(
data
,
false
)},
params
<-
prepare_activity_params
(
data
),
{
:containment
,
:ok
}
<-
{
:containment
,
Containment
.
contain_origin
(
id
,
params
)},
{
:
ok
,
activity
}
<-
Transmogrifier
.
handle_incoming
(
params
,
options
)
,
{
:
transmogrifier
,
{
:ok
,
activity
}}
<-
{
:transmogrifier
,
Transmogrifier
.
handle_incoming
(
params
,
options
)}
,
{
:object
,
_data
,
%
Object
{}
=
object
}
<-
{
:object
,
data
,
Object
.
normalize
(
activity
,
false
)}
do
{
:ok
,
object
}
...
...
@@ -74,9 +74,12 @@ defmodule Pleroma.Object.Fetcher do
{
:containment
,
_
}
->
{
:error
,
"Object containment failed."
}
{
:
error
,
{
:reject
,
nil
}}
->
{
:
transmogrifier
,
{
:error
,
{
:reject
,
nil
}
}}
->
{
:reject
,
nil
}
{
:transmogrifier
,
_
}
->
{
:error
,
"Transmogrifier failure."
}
{
:object
,
data
,
nil
}
->
reinject_object
(%
Object
{},
data
)
...
...
@@ -106,7 +109,8 @@ defmodule Pleroma.Object.Fetcher do
with
{
:ok
,
object
}
<-
fetch_object_from_id
(
id
,
options
)
do
object
else
_e
->
e
->
Logger
.
error
(
"Error while fetching
#{
id
}
:
#{
inspect
(
e
)
}
"
)
nil
end
end
...
...
@@ -153,7 +157,7 @@ defmodule Pleroma.Object.Fetcher do
Logger
.
debug
(
"Fetch headers:
#{
inspect
(
headers
)
}
"
)
with
true
<-
String
.
starts_with?
(
id
,
"http"
)
,
with
{
:scheme
,
true
}
<-
{
:scheme
,
String
.
starts_with?
(
id
,
"http"
)}
,
{
:ok
,
%{
body:
body
,
status:
code
}}
when
code
in
200
..
299
<-
HTTP
.
get
(
id
,
headers
),
{
:ok
,
data
}
<-
Jason
.
decode
(
body
),
:ok
<-
Containment
.
contain_origin_from_id
(
id
,
data
)
do
...
...
@@ -162,6 +166,9 @@ defmodule Pleroma.Object.Fetcher do
{
:ok
,
%{
status:
code
}}
when
code
in
[
404
,
410
]
->
{
:error
,
"Object has been deleted"
}
{
:scheme
,
_
}
->
{
:error
,
"Unsupported URI scheme"
}
e
->
{
:error
,
e
}
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment