playlist/Print: throw PlaylistError::NoSuchList instead of returning false
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "Partition.hxx"
|
||||
#include "Instance.hxx"
|
||||
#include "PlaylistError.hxx"
|
||||
|
||||
static void
|
||||
playlist_provider_print(Response &r,
|
||||
@@ -48,7 +49,7 @@ playlist_provider_print(Response &r,
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
playlist_file_print(Response &r, Partition &partition,
|
||||
const SongLoader &loader,
|
||||
const LocatedUri &uri,
|
||||
@@ -68,9 +69,8 @@ playlist_file_print(Response &r, Partition &partition,
|
||||
#endif
|
||||
mutex);
|
||||
if (playlist == nullptr)
|
||||
return false;
|
||||
throw PlaylistError::NoSuchList();
|
||||
|
||||
playlist_provider_print(r, loader, uri.canonical_uri, *playlist,
|
||||
start_index, end_index, detail);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Copyright The Music Player Daemon Project
|
||||
|
||||
#ifndef MPD_PLAYLIST__PRINT_HXX
|
||||
#define MPD_PLAYLIST__PRINT_HXX
|
||||
#pragma once
|
||||
|
||||
class Response;
|
||||
class SongLoader;
|
||||
@@ -11,15 +10,14 @@ struct Partition;
|
||||
/**
|
||||
* Send the playlist file to the client.
|
||||
*
|
||||
* Throws on error.
|
||||
*
|
||||
* @param uri the URI of the playlist file in UTF-8 encoding
|
||||
* @param detail true if all details should be printed
|
||||
* @return true on success, false if the playlist does not exist
|
||||
*/
|
||||
bool
|
||||
void
|
||||
playlist_file_print(Response &r, Partition &partition,
|
||||
const SongLoader &loader,
|
||||
const LocatedUri &uri,
|
||||
unsigned start_index, unsigned end_index,
|
||||
bool detail);
|
||||
|
||||
#endif
|
||||
unsigned start_index, unsigned end_index,
|
||||
bool detail);
|
||||
|
||||
Reference in New Issue
Block a user