{
Interop.Playlist.GetPlaylistFromDb(playlistId, out handle).ThrowIfError("Failed to query");
- if (handle == IntPtr.Zero)
- {
- throw new RecordNotFoundException("No matching playlist exists.");
- }
-
Interop.Playlist.ExportToFile(handle, path).ThrowIfError("Failed to export");
}
+ catch (ArgumentException)
+ {
+ // Native FW returns ArgumentException when there's no matched record.
+ throw new RecordNotFoundException("No matching playlist exists.");
+ }
finally
{
if (handle != IntPtr.Zero)
{
Interop.Playlist.GetPlaylistFromDb(playlistId, out handle).ThrowIfError("Failed to query");
- if (handle == IntPtr.Zero)
- {
- return null;
- }
-
return new Playlist(handle);
}
+ catch (ArgumentException)
+ {
+ // Native FW returns ArgumentException when there's no matched record.
+ return null;
+ }
finally
{
if (handle != IntPtr.Zero)
{
Interop.Storage.GetStorageInfoFromDb(storageId, out handle).ThrowIfError("Failed to query");
- return handle == IntPtr.Zero ? null : new Storage(handle);
+ return new Storage(handle);
+ }
+ catch (ArgumentException)
+ {
+ // Native FW returns ArgumentException when there's no matched record.
+ return null;
}
finally
{
{
Interop.Tag.GetTagFromDb(tagId, out handle).ThrowIfError("Failed to query");
- if (handle == IntPtr.Zero)
- {
- return null;
- }
return new Tag(handle);
}
+ catch (ArgumentException)
+ {
+ // Native FW returns ArgumentException when there's no matched record.
+ return null;
+ }
finally
{
if (handle != IntPtr.Zero)