Improve handling of missing and invalid attachments.

This commit is contained in:
akwizgran
2019-06-18 15:24:49 +01:00
parent ed20b2d8d6
commit 593a0c4632
8 changed files with 109 additions and 112 deletions

View File

@@ -0,0 +1,14 @@
package org.briarproject.briar.api.messaging;
import org.briarproject.bramble.api.db.DbException;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
/**
* An exception that is thrown when an {@link AttachmentHeader} is used to
* load an {@link Attachment}, and the header refers to a message that is not
* an attachment, or to an attachment that does not have the expected content
* type.
*/
@NotNullByDefault
public class InvalidAttachmentException extends DbException {
}

View File

@@ -69,6 +69,10 @@ public interface MessagingManager extends ConversationClient {
/**
* Returns the attachment with the given message ID and content type.
*
* @throws InvalidAttachmentException If the header refers to a message
* that is not an attachment, or to an attachment that does not have the
* expected content type
*/
Attachment getAttachment(AttachmentHeader h) throws DbException;