Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
fe0b6a11
Commit
fe0b6a11
authored
Dec 28, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlaylistFile: convert system_error::ENOENT to PlaylistResult::NO_SUCH_LIST
parent
72851647
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
PlaylistError.hxx
src/PlaylistError.hxx
+5
-0
PlaylistFile.cxx
src/PlaylistFile.cxx
+10
-2
No files found.
src/PlaylistError.hxx
View file @
fe0b6a11
...
...
@@ -55,6 +55,11 @@ public:
"No such song"
);
}
static
PlaylistError
NoSuchList
()
{
return
PlaylistError
(
PlaylistResult
::
NO_SUCH_LIST
,
"No such playlist"
);
}
static
PlaylistError
BadRange
()
{
return
PlaylistError
(
PlaylistResult
::
BAD_RANGE
,
"Bad song index"
);
...
...
src/PlaylistFile.cxx
View file @
fe0b6a11
...
...
@@ -247,7 +247,7 @@ SavePlaylistFile(const PlaylistFileContents &contents, const char *utf8path,
PlaylistFileContents
LoadPlaylistFile
(
const
char
*
utf8path
,
Error
&
error
)
{
try
{
PlaylistFileContents
contents
;
const
auto
path_fs
=
spl_map_to_fs
(
utf8path
,
error
);
...
...
@@ -301,6 +301,10 @@ LoadPlaylistFile(const char *utf8path, Error &error)
}
return
contents
;
}
catch
(
const
std
::
system_error
&
e
)
{
if
(
IsFileNotFound
(
e
))
throw
PlaylistError
::
NoSuchList
();
throw
;
}
bool
...
...
@@ -393,7 +397,7 @@ spl_remove_index(const char *utf8path, unsigned pos, Error &error)
bool
spl_append_song
(
const
char
*
utf8path
,
const
DetachedSong
&
song
,
Error
&
error
)
{
try
{
const
auto
path_fs
=
spl_map_to_fs
(
utf8path
,
error
);
if
(
path_fs
.
IsNull
())
return
false
;
...
...
@@ -415,6 +419,10 @@ spl_append_song(const char *utf8path, const DetachedSong &song, Error &error)
idle_add
(
IDLE_STORED_PLAYLIST
);
return
true
;
}
catch
(
const
std
::
system_error
&
e
)
{
if
(
IsFileNotFound
(
e
))
throw
PlaylistError
::
NoSuchList
();
throw
;
}
bool
...
...
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