[geary/mjog/rfc822-cleanup: 14/15] Geary.RFC822Error: Rename so it's actually in the RFC822 namespace
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/rfc822-cleanup: 14/15] Geary.RFC822Error: Rename so it's actually in the RFC822 namespace
- Date: Wed, 6 May 2020 05:00:27 +0000 (UTC)
commit 26e76b6f4d125d81e9d33282faee33b82b7e2ec4
Author: Michael Gratton <mike vee net>
Date: Wed May 6 13:54:59 2020 +1000
Geary.RFC822Error: Rename so it's actually in the RFC822 namespace
src/client/accounts/accounts-manager.vala | 4 +-
src/client/composer/composer-email-entry.vala | 2 +-
.../conversation-viewer/conversation-message.vala | 2 +-
src/engine/api/geary-email.vala | 4 +-
src/engine/imap-db/imap-db-message-row.vala | 4 +-
src/engine/imap/message/imap-message-data.vala | 2 +-
src/engine/rfc822/rfc822-error.vala | 6 +-
src/engine/rfc822/rfc822-mailbox-address.vala | 10 ++--
src/engine/rfc822/rfc822-mailbox-addresses.vala | 8 +--
src/engine/rfc822/rfc822-message-data.vala | 10 ++--
src/engine/rfc822/rfc822-message.vala | 65 +++++++++++-----------
src/engine/rfc822/rfc822-part.vala | 16 +++---
.../engine/rfc822/rfc822-mailbox-address-test.vala | 16 +++---
.../rfc822/rfc822-mailbox-addresses-test.vala | 8 +--
test/engine/rfc822/rfc822-message-data-test.vala | 2 +-
test/engine/rfc822/rfc822-message-test.vala | 50 ++++++++---------
test/engine/rfc822/rfc822-part-test.vala | 10 ++--
test/engine/rfc822/rfc822-utils-test.vala | 2 +-
test/integration/smtp/client-session.vala | 2 +-
19 files changed, 112 insertions(+), 111 deletions(-)
---
diff --git a/src/client/accounts/accounts-manager.vala b/src/client/accounts/accounts-manager.vala
index 7b7c101ca..c0ead2bbf 100644
--- a/src/client/accounts/accounts-manager.vala
+++ b/src/client/accounts/accounts-manager.vala
@@ -1051,7 +1051,7 @@ public class Accounts.AccountConfigV1 : AccountConfig, GLib.Object {
senders.add(
new Geary.RFC822.MailboxAddress.from_rfc822_string(sender)
);
- } catch (Geary.RFC822Error err) {
+ } catch (Geary.RFC822.Error err) {
throw new ConfigError.SYNTAX(
"%s: Invalid sender address: %s", id, sender
);
@@ -1279,7 +1279,7 @@ public class Accounts.AccountConfigLegacy : AccountConfig, GLib.Object {
foreach (Geary.RFC822.MailboxAddress mailbox in mailboxes.get_all()) {
info.append_sender(mailbox);
}
- } catch (Geary.RFC822Error error) {
+ } catch (Geary.RFC822.Error error) {
throw new ConfigError.SYNTAX(
"Invalid alternate email: %s", error.message
);
diff --git a/src/client/composer/composer-email-entry.vala b/src/client/composer/composer-email-entry.vala
index cd4202b0b..6b4955109 100644
--- a/src/client/composer/composer-email-entry.vala
+++ b/src/client/composer/composer-email-entry.vala
@@ -85,7 +85,7 @@ public class Composer.EmailEntry : Gtk.Entry {
this._addresses =
new Geary.RFC822.MailboxAddresses.from_rfc822_string(text);
this.is_valid = true;
- } catch (Geary.RFC822Error err) {
+ } catch (Geary.RFC822.Error err) {
this._addresses = new Geary.RFC822.MailboxAddresses();
this.is_valid = false;
}
diff --git a/src/client/conversation-viewer/conversation-message.vala
b/src/client/conversation-viewer/conversation-message.vala
index a7494ad8b..50ac031e0 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -1029,7 +1029,7 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
id,
part.write_to_buffer(Geary.RFC822.Part.EncodingConversion.UTF8)
);
- } catch (Geary.RFC822Error err) {
+ } catch (Geary.RFC822.Error err) {
debug("Failed to get inline buffer: %s", err.message);
return null;
}
diff --git a/src/engine/api/geary-email.vala b/src/engine/api/geary-email.vala
index b2b77c867..d6a0fe6de 100644
--- a/src/engine/api/geary-email.vala
+++ b/src/engine/api/geary-email.vala
@@ -381,7 +381,7 @@ public class Geary.Email : BaseObject, EmailHeaderSet {
public void set_originators(Geary.RFC822.MailboxAddresses? from,
Geary.RFC822.MailboxAddress? sender,
Geary.RFC822.MailboxAddresses? reply_to)
- throws RFC822Error {
+ throws Error {
// XXX Should be throwing an error here if from is empty or
// sender is same as from
this.from = from;
@@ -477,7 +477,7 @@ public class Geary.Email : BaseObject, EmailHeaderSet {
* present. If not, {@link EngineError.INCOMPLETE_MESSAGE} is
* thrown.
*/
- public Geary.RFC822.Message get_message() throws EngineError, RFC822Error {
+ public Geary.RFC822.Message get_message() throws EngineError, Error {
if (message != null)
return message;
diff --git a/src/engine/imap-db/imap-db-message-row.vala b/src/engine/imap-db/imap-db-message-row.vala
index 0b09a8cd4..03b49b0dd 100644
--- a/src/engine/imap-db/imap-db-message-row.vala
+++ b/src/engine/imap-db/imap-db-message-row.vala
@@ -275,7 +275,7 @@ private class Geary.ImapDB.MessageRow {
}
private RFC822.MailboxAddress? unflatten_address(string? str)
- throws RFC822Error {
+ throws RFC822.Error {
return (
String.is_empty_or_whitespace(str)
? null
@@ -284,7 +284,7 @@ private class Geary.ImapDB.MessageRow {
}
private RFC822.MailboxAddresses? unflatten_addresses(string? str)
- throws RFC822Error {
+ throws RFC822.Error {
return (
String.is_empty_or_whitespace(str)
? null
diff --git a/src/engine/imap/message/imap-message-data.vala b/src/engine/imap/message/imap-message-data.vala
index b61a89446..189333034 100644
--- a/src/engine/imap/message/imap-message-data.vala
+++ b/src/engine/imap/message/imap-message-data.vala
@@ -30,7 +30,7 @@ public class Geary.Imap.RFC822Header : Geary.RFC822.Header, Geary.Imap.MessageDa
throws ImapError {
try {
base(buffer);
- } catch (RFC822Error error) {
+ } catch (RFC822.Error error) {
throw new ImapError.INVALID(error.message);
}
}
diff --git a/src/engine/rfc822/rfc822-error.vala b/src/engine/rfc822/rfc822-error.vala
index 23105ca70..758912a73 100644
--- a/src/engine/rfc822/rfc822-error.vala
+++ b/src/engine/rfc822/rfc822-error.vala
@@ -4,9 +4,11 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
-public errordomain Geary.RFC822Error {
+/**
+ * An error that is thrown when manipulating RFC 822 objects and data.
+ */
+public errordomain Geary.RFC822.Error {
INVALID,
NOT_FOUND,
FAILED
}
-
diff --git a/src/engine/rfc822/rfc822-mailbox-address.vala b/src/engine/rfc822/rfc822-mailbox-address.vala
index 089fc4597..173312a7b 100644
--- a/src/engine/rfc822/rfc822-mailbox-address.vala
+++ b/src/engine/rfc822/rfc822-mailbox-address.vala
@@ -231,18 +231,16 @@ public class Geary.RFC822.MailboxAddress :
this.address = "%s@%s".printf(mailbox, domain);
}
- public MailboxAddress.from_rfc822_string(string rfc822) throws RFC822Error {
+ public MailboxAddress.from_rfc822_string(string rfc822) throws Error {
GMime.InternetAddressList addrlist = GMime.InternetAddressList.parse(
Geary.RFC822.get_parser_options(),
rfc822
);
if (addrlist == null) {
- throw new RFC822Error.INVALID(
- "Not a RFC822 mailbox address: %s", rfc822
- );
+ throw new Error.INVALID("Not a RFC822 mailbox address: %s", rfc822);
}
if (addrlist.length() != 1) {
- throw new RFC822Error.INVALID(
+ throw new Error.INVALID(
"Not a single RFC822 mailbox address: %s", rfc822
);
}
@@ -251,7 +249,7 @@ public class Geary.RFC822.MailboxAddress :
// TODO: Handle group lists
var mbox_addr = addr as GMime.InternetAddressMailbox;
if (mbox_addr == null) {
- throw new RFC822Error.INVALID(
+ throw new Error.INVALID(
"Group lists not currently supported: %s", rfc822
);
}
diff --git a/src/engine/rfc822/rfc822-mailbox-addresses.vala b/src/engine/rfc822/rfc822-mailbox-addresses.vala
index e39b27e80..40ba2462b 100644
--- a/src/engine/rfc822/rfc822-mailbox-addresses.vala
+++ b/src/engine/rfc822/rfc822-mailbox-addresses.vala
@@ -82,19 +82,19 @@ public class Geary.RFC822.MailboxAddresses :
}
public MailboxAddresses.from_rfc822_string(string rfc822)
- throws RFC822Error {
+ throws Error {
var list = GMime.InternetAddressList.parse(null, rfc822);
if (list == null) {
- throw new RFC822Error.INVALID("Not a RFC822 mailbox address list");
+ throw new Error.INVALID("Not a RFC822 mailbox address list");
}
this.from_gmime(list);
}
public MailboxAddresses.from_gmime(GMime.InternetAddressList list)
- throws RFC822Error {
+ throws Error {
int length = list.length();
if (length == 0) {
- throw new RFC822Error.INVALID("No addresses in list");
+ throw new Error.INVALID("No addresses in list");
}
for (int i = 0; i < length; i++) {
var addr = list.get_address(i);
diff --git a/src/engine/rfc822/rfc822-message-data.vala b/src/engine/rfc822/rfc822-message-data.vala
index e228b3443..48b1d6f7e 100644
--- a/src/engine/rfc822/rfc822-message-data.vala
+++ b/src/engine/rfc822/rfc822-message-data.vala
@@ -234,10 +234,10 @@ public class Geary.RFC822.Date :
this.rfc822 = null;
}
- public Date.from_rfc822_string(string rfc822) throws RFC822Error {
+ public Date.from_rfc822_string(string rfc822) throws Error {
var date = GMime.utils_header_decode_date(rfc822);
if (date == null) {
- throw new RFC822Error.INVALID("Not ISO-8601 date: %s", rfc822);
+ throw new Error.INVALID("Not ISO-8601 date: %s", rfc822);
}
this.rfc822 = rfc822;
this.value = date;
@@ -367,7 +367,7 @@ public class Geary.RFC822.Header :
private GMime.Message? message = null;
private string[]? names = null;
- public Header(Memory.Buffer buffer) throws RFC822Error {
+ public Header(Memory.Buffer buffer) throws Error {
base("RFC822.Header", buffer);
var parser = new GMime.Parser.with_stream(
@@ -378,7 +378,7 @@ public class Geary.RFC822.Header :
this.message = parser.construct_message(null);
if (this.message == null) {
- throw new RFC822Error.INVALID("Unable to parse RFC 822 headers");
+ throw new Error.INVALID("Unable to parse RFC 822 headers");
}
}
@@ -460,7 +460,7 @@ public class Geary.RFC822.PreviewText : Geary.RFC822.Text {
preview_buffer.get_valid_utf8(),
is_html ? TextFormat.HTML : TextFormat.PLAIN
);
- } catch (RFC822Error err) {
+ } catch (Error err) {
debug("Failed to parse preview body: %s", err.message);
}
}
diff --git a/src/engine/rfc822/rfc822-message.vala b/src/engine/rfc822/rfc822-message.vala
index 368940849..fae87da24 100644
--- a/src/engine/rfc822/rfc822-message.vala
+++ b/src/engine/rfc822/rfc822-message.vala
@@ -84,13 +84,13 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
private size_t? body_offset = null;
- public Message(Full full) throws RFC822Error {
+ public Message(Full full) throws Error {
GMime.Parser parser = new GMime.Parser.with_stream(
Utils.create_stream_mem(full.buffer)
);
var message = parser.construct_message(get_parser_options());
if (message == null) {
- throw new RFC822Error.INVALID("Unable to parse RFC 822 message");
+ throw new Error.INVALID("Unable to parse RFC 822 message");
}
this.from_gmime_message(message);
@@ -101,7 +101,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
}
public Message.from_gmime_message(GMime.Message message)
- throws RFC822Error {
+ throws Error {
this.message = message;
this.from = to_addresses(message.get_from());
@@ -160,12 +160,12 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
}
public Message.from_buffer(Memory.Buffer full_email)
- throws RFC822Error {
+ throws Error {
this(new Geary.RFC822.Full(full_email));
}
public Message.from_parts(Header header, Text body)
- throws RFC822Error {
+ throws Error {
GMime.StreamCat stream_cat = new GMime.StreamCat();
stream_cat.add_source(new GMime.StreamMem.with_buffer(header.buffer.get_bytes().get_data()));
stream_cat.add_source(new GMime.StreamMem.with_buffer(body.buffer.get_bytes().get_data()));
@@ -173,7 +173,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
GMime.Parser parser = new GMime.Parser.with_stream(stream_cat);
var message = parser.construct_message(Geary.RFC822.get_parser_options());
if (message == null) {
- throw new RFC822Error.INVALID("Unable to parse RFC 822 message");
+ throw new Error.INVALID("Unable to parse RFC 822 message");
}
this.from_gmime_message(message);
@@ -186,7 +186,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
public async Message.from_composed_email(Geary.ComposedEmail email,
string? message_id,
GLib.Cancellable? cancellable)
- throws RFC822Error {
+ throws Error {
this.message = new GMime.Message(true);
//
@@ -510,15 +510,14 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
string basename,
Geary.Mime.DispositionType disposition,
GLib.Cancellable cancellable)
- throws Error {
-
+ throws GLib.Error {
Mime.ContentType? mime_type = Mime.ContentType.guess_type(
basename,
buffer
);
if (mime_type == null) {
- throw new RFC822Error.INVALID(
+ throw new Error.INVALID(
_("Could not determine mime type for “%s”.").printf(basename)
);
}
@@ -529,7 +528,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
);
if (content_type == null) {
- throw new RFC822Error.INVALID(
+ throw new Error.INVALID(
_("Could not determine content type for mime type “%s” on
“%s”.").printf(mime_type.to_string(), basename)
);
}
@@ -551,7 +550,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
GMime.Part part,
GMime.ContentType content_type,
GLib.Cancellable cancellable)
- throws Error {
+ throws GLib.Error {
// Text parts should be scanned fully to determine best
// (i.e. most compact) transport encoding to use, but
@@ -587,7 +586,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
* out. See the various constructors for details. (Otherwise, we don't have a way
* to get the body part directly, because of GMime's shortcomings.)
*/
- public Geary.Email get_email(Geary.EmailIdentifier id) throws Error {
+ public Geary.Email get_email(Geary.EmailIdentifier id) throws GLib.Error {
assert(body_buffer != null);
assert(body_offset != null);
@@ -653,7 +652,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
* Returns the {@link Message} as a {@link Memory.Buffer} suitable for in-memory use (i.e.
* with native linefeed characters).
*/
- public Memory.Buffer get_native_buffer() throws RFC822Error {
+ public Memory.Buffer get_native_buffer() throws Error {
return message_to_memory_buffer(false, false);
}
@@ -664,7 +663,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
* The buffer can also be dot-stuffed if required. See
* [[http://tools.ietf.org/html/rfc2821#section-4.5.2]]
*/
- public Memory.Buffer get_network_buffer(bool dotstuffed) throws RFC822Error {
+ public Memory.Buffer get_network_buffer(bool dotstuffed) throws Error {
return message_to_memory_buffer(true, dotstuffed);
}
@@ -740,7 +739,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
bool to_html,
InlinePartReplacer? replacer,
ref string? body)
- throws RFC822Error {
+ throws Error {
Part part = new Part(node);
Mime.ContentType content_type = part.content_type;
@@ -807,11 +806,11 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
* something that front-facing methods want to return.
*/
private string? internal_get_body(string text_subtype, bool to_html, InlinePartReplacer? replacer)
- throws RFC822Error {
+ throws Error {
string? body = null;
if (!construct_body_from_mime_parts(message.get_mime_part(), Mime.MultipartSubtype.UNSPECIFIED,
text_subtype, to_html, replacer, ref body)) {
- throw new RFC822Error.NOT_FOUND("Could not find any \"text/%s\" parts", text_subtype);
+ throw new Error.NOT_FOUND("Could not find any \"text/%s\" parts", text_subtype);
}
return body;
@@ -828,9 +827,9 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
* lieu of the MIME part into the final document. All other MIME
* parts are ignored.
*
- * @throws RFC822Error.NOT_FOUND if an HTML body is not present.
+ * @throws Error.NOT_FOUND if an HTML body is not present.
*/
- public string? get_html_body(InlinePartReplacer? replacer) throws RFC822Error {
+ public string? get_html_body(InlinePartReplacer? replacer) throws Error {
return internal_get_body("html", false, replacer);
}
@@ -850,9 +849,10 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
* output is not converted; it's up to the caller to know what
* format to return when invoked.
*
- * @throws RFC822Error.NOT_FOUND if a plaintext body is not present.
+ * @throws Error.NOT_FOUND if a plaintext body is not present.
*/
- public string? get_plain_body(bool convert_to_html, InlinePartReplacer? replacer) throws RFC822Error {
+ public string? get_plain_body(bool convert_to_html, InlinePartReplacer? replacer)
+ throws Error {
return internal_get_body("plain", convert_to_html, replacer);
}
@@ -864,7 +864,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
* that come out of this function are persisted.
*/
public string? get_searchable_body(bool include_sub_messages = true)
- throws RFC822Error {
+ throws Error {
string? body = null;
bool html = false;
try {
@@ -936,14 +936,15 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
// UNSPECIFIED disposition means "return all Mime parts"
internal Gee.List<Part> get_attachments(
- Mime.DispositionType disposition = Mime.DispositionType.UNSPECIFIED) throws RFC822Error {
+ Mime.DispositionType disposition = Mime.DispositionType.UNSPECIFIED)
+ throws Error {
Gee.List<Part> attachments = new Gee.LinkedList<Part>();
get_attachments_recursively(attachments, message.get_mime_part(), disposition);
return attachments;
}
private MailboxAddresses? to_addresses(GMime.InternetAddressList? list)
- throws RFC822Error {
+ throws Error {
MailboxAddresses? addresses = null;
if (list != null && list.length() > 0) {
addresses = new MailboxAddresses.from_gmime(list);
@@ -963,7 +964,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
private void get_attachments_recursively(Gee.List<Part> attachments,
GMime.Object root,
Mime.DispositionType requested_disposition)
- throws RFC822Error {
+ throws Error {
if (root is GMime.Multipart) {
GMime.Multipart multipart = (GMime.Multipart) root;
int count = multipart.get_count();
@@ -1052,7 +1053,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
#endif
public Gee.List<Geary.RFC822.Message> get_sub_messages()
- throws RFC822Error {
+ throws Error {
Gee.List<Geary.RFC822.Message> messages = new Gee.ArrayList<Geary.RFC822.Message>();
find_sub_messages(messages, message.get_mime_part());
return messages;
@@ -1060,7 +1061,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
private void find_sub_messages(Gee.List<Message> messages,
GMime.Object root)
- throws RFC822Error {
+ throws Error {
// If this is a multipart container, check each of its children.
GMime.Multipart? multipart = root as GMime.Multipart;
if (multipart != null) {
@@ -1084,7 +1085,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
private Memory.Buffer message_to_memory_buffer(bool encode_lf,
bool stuff_smtp)
- throws RFC822Error {
+ throws Error {
ByteArray byte_array = new ByteArray();
GMime.StreamMem stream = new GMime.StreamMem.with_byte_array(byte_array);
stream.set_owner(false);
@@ -1100,13 +1101,13 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
}
if (message.write_to_stream(Geary.RFC822.get_format_options(), stream_filter) < 0)
- throw new RFC822Error.FAILED("Unable to write RFC822 message to filter stream");
+ throw new Error.FAILED("Unable to write RFC822 message to filter stream");
if (stream_filter.flush() != 0)
- throw new RFC822Error.FAILED("Unable to flush RFC822 message to memory stream");
+ throw new Error.FAILED("Unable to flush RFC822 message to memory stream");
if (stream.flush() != 0)
- throw new RFC822Error.FAILED("Unable to flush RFC822 message to memory buffer");
+ throw new Error.FAILED("Unable to flush RFC822 message to memory buffer");
return new Memory.ByteBuffer.from_byte_array(byte_array);
}
diff --git a/src/engine/rfc822/rfc822-part.vala b/src/engine/rfc822/rfc822-part.vala
index 58c58ff03..9f19b6a2d 100644
--- a/src/engine/rfc822/rfc822-part.vala
+++ b/src/engine/rfc822/rfc822-part.vala
@@ -145,7 +145,7 @@ public class Geary.RFC822.Part : Object {
public Memory.Buffer write_to_buffer(EncodingConversion conversion,
BodyFormatting format = BodyFormatting.NONE)
- throws RFC822Error {
+ throws Error {
ByteArray byte_array = new ByteArray();
GMime.StreamMem stream = new GMime.StreamMem.with_byte_array(byte_array);
stream.set_owner(false);
@@ -158,11 +158,11 @@ public class Geary.RFC822.Part : Object {
internal void write_to_stream(GMime.Stream destination,
EncodingConversion conversion,
BodyFormatting format = BodyFormatting.NONE)
- throws RFC822Error {
+ throws Error {
GMime.DataWrapper? wrapper = (this.source_part != null)
? this.source_part.get_content() : null;
if (wrapper == null) {
- throw new RFC822Error.INVALID(
+ throw new Error.INVALID(
"Could not get the content wrapper for content-type %s",
content_type.to_string()
);
@@ -227,17 +227,17 @@ public class Geary.RFC822.Part : Object {
}
if (wrapper.write_to_stream(filter) < 0)
- throw new RFC822Error.FAILED("Unable to write textual RFC822 part to filter stream");
+ throw new Error.FAILED("Unable to write textual RFC822 part to filter stream");
if (filter.flush() != 0)
- throw new RFC822Error.FAILED("Unable to flush textual RFC822 part to destination stream");
+ throw new Error.FAILED("Unable to flush textual RFC822 part to destination stream");
if (destination.flush() != 0)
- throw new RFC822Error.FAILED("Unable to flush textual RFC822 part to destination");
+ throw new Error.FAILED("Unable to flush textual RFC822 part to destination");
} else {
// Keep as binary
if (wrapper.write_to_stream(destination) < 0)
- throw new RFC822Error.FAILED("Unable to write binary RFC822 part to destination stream");
+ throw new Error.FAILED("Unable to write binary RFC822 part to destination stream");
if (destination.flush() != 0)
- throw new RFC822Error.FAILED("Unable to flush binary RFC822 part to destination");
+ throw new Error.FAILED("Unable to flush binary RFC822 part to destination");
}
}
diff --git a/test/engine/rfc822/rfc822-mailbox-address-test.vala
b/test/engine/rfc822/rfc822-mailbox-address-test.vala
index 6b47a81fe..7436629d1 100644
--- a/test/engine/rfc822/rfc822-mailbox-address-test.vala
+++ b/test/engine/rfc822/rfc822-mailbox-address-test.vala
@@ -24,7 +24,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
add_test("equal_to", equal_to);
}
- public void is_valid_address() throws Error {
+ public void is_valid_address() throws GLib.Error {
assert(Geary.RFC822.MailboxAddress.is_valid_address("john dep aol.museum") == true);
assert(Geary.RFC822.MailboxAddress.is_valid_address("test example com") == true);
assert(Geary.RFC822.MailboxAddress.is_valid_address("test other example com") == true);
@@ -44,7 +44,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
assert(Geary.RFC822.MailboxAddress.is_valid_address("\"Surname, Name\" <mail example com>") == true);
}
- public void unescaped_constructor() throws Error {
+ public void unescaped_constructor() throws GLib.Error {
MailboxAddress addr1 = new MailboxAddress("test1", "test2 example com");
assert(addr1.name == "test1");
assert(addr1.address == "test2 example com");
@@ -72,7 +72,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
assert(addr5.domain == "");
}
- public void from_rfc822_string_encoded() throws Error {
+ public void from_rfc822_string_encoded() throws GLib.Error {
try {
MailboxAddress addr = new MailboxAddress.from_rfc822_string("test example com");
assert(addr.name == null);
@@ -172,7 +172,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
assert(addr.name == "Firstname ¯_(ツ)_/¯ Lastname via=?UTF-8?Q?_Vendor=22_");
}
- public void has_distinct_name() throws Error {
+ public void has_distinct_name() throws GLib.Error {
assert(new MailboxAddress("example", "example example com").has_distinct_name() == true);
assert(new MailboxAddress("", "example example com").has_distinct_name() == false);
@@ -185,7 +185,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
assert(new MailboxAddress("'prefix-example example com'", "example example com").has_distinct_name()
== true);
}
- public void is_spoofed() throws Error {
+ public void is_spoofed() throws GLib.Error {
assert(new MailboxAddress(null, "example example com").is_spoofed() == false);
assert(new MailboxAddress("", "example example com").is_spoofed() == false);
assert(new MailboxAddress("", "example example com").is_spoofed() == false);
@@ -213,7 +213,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
}
}
- public void to_full_display() throws Error {
+ public void to_full_display() throws GLib.Error {
assert(new MailboxAddress("", "example example com").to_full_display() ==
"example example com");
assert(new MailboxAddress("Test", "example example com").to_full_display() ==
@@ -229,7 +229,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
);
}
- public void to_short_display() throws Error {
+ public void to_short_display() throws GLib.Error {
assert(new MailboxAddress("", "example example com").to_short_display() ==
"example example com");
assert(new MailboxAddress("Test", "example example com").to_short_display() ==
@@ -288,7 +288,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
}
- public void to_rfc822_string() throws Error {
+ public void to_rfc822_string() throws GLib.Error {
assert(new MailboxAddress("", "example example com").to_rfc822_string() ==
"example example com");
assert(new MailboxAddress(" ", "example example com").to_rfc822_string() ==
diff --git a/test/engine/rfc822/rfc822-mailbox-addresses-test.vala
b/test/engine/rfc822/rfc822-mailbox-addresses-test.vala
index 70e535d5a..f3fc2fa8f 100644
--- a/test/engine/rfc822/rfc822-mailbox-addresses-test.vala
+++ b/test/engine/rfc822/rfc822-mailbox-addresses-test.vala
@@ -16,7 +16,7 @@ class Geary.RFC822.MailboxAddressesTest : TestCase {
add_test("hash", hash);
}
- public void from_rfc822_string_encoded() throws Error {
+ public void from_rfc822_string_encoded() throws GLib.Error {
MailboxAddresses addrs = new MailboxAddresses.from_rfc822_string("test example com");
assert(addrs.size == 1);
@@ -43,7 +43,7 @@ class Geary.RFC822.MailboxAddressesTest : TestCase {
assert_string("\"Surname, Name\" <mail example com>", addrs.to_rfc822_string());
}
- public void to_rfc822_string() throws Error {
+ public void to_rfc822_string() throws GLib.Error {
assert(new MailboxAddresses().to_rfc822_string() == "");
assert(new_addreses({ "test1 example com" })
.to_rfc822_string() == "test1 example com");
@@ -51,7 +51,7 @@ class Geary.RFC822.MailboxAddressesTest : TestCase {
.to_rfc822_string() == "test1 example com, test2 example com");
}
- public void equal_to() throws Error {
+ public void equal_to() throws GLib.Error {
var mailboxes_a = new_addreses({ "test1 example com" });
var mailboxes_b = new_addreses({ "test1 example com" });
var mailboxes_c = new_addreses({ "test2 example com" });
@@ -83,7 +83,7 @@ class Geary.RFC822.MailboxAddressesTest : TestCase {
);
}
- public void hash() throws Error {
+ public void hash() throws GLib.Error {
var mailboxes_a = new_addreses({ "test1 example com" });
var mailboxes_b = new_addreses({ "test1 example com" });
var mailboxes_c = new_addreses({ "test2 example com" });
diff --git a/test/engine/rfc822/rfc822-message-data-test.vala
b/test/engine/rfc822/rfc822-message-data-test.vala
index dd9b2bf36..c6bc1553c 100644
--- a/test/engine/rfc822/rfc822-message-data-test.vala
+++ b/test/engine/rfc822/rfc822-message-data-test.vala
@@ -17,7 +17,7 @@ class Geary.RFC822.MessageDataTest : TestCase {
add_test("PreviewText.with_header", preview_text_with_header);
}
- public void preview_text_with_header() throws Error {
+ public void preview_text_with_header() throws GLib.Error {
PreviewText plain_preview1 = new PreviewText.with_header(
new Geary.Memory.StringBuffer(PLAIN_BODY1_HEADERS),
new Geary.Memory.StringBuffer(PLAIN_BODY1_ENCODED)
diff --git a/test/engine/rfc822/rfc822-message-test.vala b/test/engine/rfc822/rfc822-message-test.vala
index 9c8de2a26..cb4bde342 100644
--- a/test/engine/rfc822/rfc822-message-test.vala
+++ b/test/engine/rfc822/rfc822-message-test.vala
@@ -64,7 +64,7 @@ This is the second line.
add_test("get_network_buffer_long_ascii_line", get_network_buffer_long_ascii_line);
}
- public void basic_message_from_buffer() throws Error {
+ public void basic_message_from_buffer() throws GLib.Error {
Message basic = resource_to_message(BASIC_TEXT_PLAIN);
assert_data(basic.subject, "Re: Basic text/plain message");
@@ -81,14 +81,14 @@ This is the second line.
assert(basic.mailer == "Geary Test Suite 1.0");
}
- public void encoded_recipient() throws Error {
+ public void encoded_recipient() throws GLib.Error {
Message enc = string_to_message(ENCODED_TO);
// Courtesy Mailsploit https://www.mailsploit.com
assert_string("potus whitehouse gov <test>", enc.to[0].name);
}
- public void duplicate_mailbox() throws Error {
+ public void duplicate_mailbox() throws GLib.Error {
Message dup = string_to_message(DUPLICATE_TO);
assert(dup.to.size == 2);
@@ -97,7 +97,7 @@ This is the second line.
);
}
- public void duplicate_message_id() throws Error {
+ public void duplicate_message_id() throws GLib.Error {
Message dup = string_to_message(DUPLICATE_REFERENCES);
assert(dup.references.size == 2);
@@ -106,7 +106,7 @@ This is the second line.
);
}
- public void text_plain_as_plain() throws Error {
+ public void text_plain_as_plain() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_PLAIN);
assert_true(test.has_plain_body(), "Expected plain body");
@@ -114,7 +114,7 @@ This is the second line.
assert_string(BASIC_PLAIN_BODY, test.get_plain_body(false, null));
}
- public void text_plain_as_html() throws Error {
+ public void text_plain_as_html() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_PLAIN);
assert_true(test.has_plain_body(), "Expected plain body");
@@ -125,7 +125,7 @@ This is the second line.
);
}
- public void text_html_as_html() throws Error {
+ public void text_html_as_html() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_HTML);
assert_true(test.has_html_body(), "Expected html body");
@@ -133,7 +133,7 @@ This is the second line.
assert_string(BASIC_HTML_BODY, test.get_html_body(null));
}
- public void text_html_as_plain() throws Error {
+ public void text_html_as_plain() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_HTML);
assert_true(test.has_html_body(), "Expected html body");
@@ -141,7 +141,7 @@ This is the second line.
assert_string(BASIC_HTML_BODY, test.get_html_body(null));
}
- public void tnef_extract_attachments() throws Error {
+ public void tnef_extract_attachments() throws GLib.Error {
Message test = resource_to_message(BASIC_MULTIPART_TNEF);
Gee.List<Part> attachments = test.get_attachments();
assert_true(attachments.size == 2);
@@ -149,7 +149,7 @@ This is the second line.
assert_true(attachments[1].get_clean_filename() == "bookmark.htm");
}
- public void multipart_alternative_as_plain() throws Error {
+ public void multipart_alternative_as_plain() throws GLib.Error {
Message test = resource_to_message(BASIC_MULTIPART_ALTERNATIVE);
assert_true(test.has_plain_body(), "Expected plain body");
@@ -157,7 +157,7 @@ This is the second line.
assert_string(BASIC_PLAIN_BODY, test.get_plain_body(false, null));
}
- public void multipart_alternative_as_converted_html() throws Error {
+ public void multipart_alternative_as_converted_html() throws GLib.Error {
Message test = resource_to_message(BASIC_MULTIPART_ALTERNATIVE);
assert_true(test.has_plain_body(), "Expected plain body");
@@ -168,7 +168,7 @@ This is the second line.
);
}
- public void multipart_alternative_as_html() throws Error {
+ public void multipart_alternative_as_html() throws GLib.Error {
Message test = resource_to_message(BASIC_MULTIPART_ALTERNATIVE);
assert_true(test.has_plain_body(), "Expected plain body");
@@ -176,13 +176,13 @@ This is the second line.
assert_string(BASIC_HTML_BODY, test.get_html_body(null));
}
- public void get_preview() throws Error {
+ public void get_preview() throws GLib.Error {
Message multipart_signed = string_to_message(MULTIPART_SIGNED_MESSAGE_TEXT);
assert(multipart_signed.get_preview() == MULTIPART_SIGNED_MESSAGE_PREVIEW);
}
- public void get_recipients() throws Error {
+ public void get_recipients() throws GLib.Error {
Message test = string_to_message(SIMPLE_MULTIRECIPIENT_TO_CC_BCC);
Gee.List<RFC822.MailboxAddress>? addresses = test.get_recipients();
@@ -195,14 +195,14 @@ This is the second line.
assert_addresses_list(addresses, verify_list, "get_recipients");
}
- public void get_searchable_body() throws Error {
+ public void get_searchable_body() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_HTML);
string searchable = test.get_searchable_body();
assert_true(searchable.contains("This is the first line"), "Expected body text");
assert_false(searchable.contains("<P>"), "Expected html removed");
}
- public void get_searchable_recipients() throws Error {
+ public void get_searchable_recipients() throws GLib.Error {
Message test = string_to_message(SIMPLE_MULTIRECIPIENT_TO_CC_BCC);
string searchable = test.get_searchable_recipients();
assert_true(searchable.contains("Jane Doe <jdoe somewhere tld>"), "Expected to address");
@@ -210,7 +210,7 @@ This is the second line.
assert_true(searchable.contains("Jane Doe BCC <jdoe_bcc somewhere tld>"), "Expected bcc address");
}
- public void get_network_buffer() throws Error {
+ public void get_network_buffer() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_PLAIN);
Memory.Buffer buffer = test.get_network_buffer(true);
assert_true(buffer.to_string() == NETWORK_BUFFER_EXPECTED, "Network buffer differs");
@@ -318,7 +318,7 @@ This is the second line.
);
}
- public void from_composed_email_inline_attachments() throws Error {
+ public void from_composed_email_inline_attachments() throws GLib.Error {
RFC822.MailboxAddress to = new RFC822.MailboxAddress(
"Test", "test example com"
);
@@ -372,7 +372,7 @@ This is the second line.
}
private async Message message_from_composed_email(ComposedEmail composed)
- throws RFC822Error {
+ throws GLib.Error {
return yield new Geary.RFC822.Message.from_composed_email(
composed,
GMime.utils_generate_message_id(composed.from.get(0).domain),
@@ -380,7 +380,7 @@ This is the second line.
);
}
- private Message resource_to_message(string path) throws Error {
+ private Message resource_to_message(string path) throws GLib.Error {
GLib.File resource =
GLib.File.new_for_uri(RESOURCE_URI).resolve_relative_path(path);
@@ -392,7 +392,7 @@ This is the second line.
);
}
- private Message string_to_message(string message_text) throws Error {
+ private Message string_to_message(string message_text) throws GLib.Error {
return new Message.from_buffer(
new Geary.Memory.StringBuffer(message_text)
);
@@ -400,21 +400,21 @@ This is the second line.
private void assert_data(Geary.MessageData.AbstractMessageData? actual,
string expected)
- throws Error {
+ throws GLib.Error {
assert_non_null(actual, expected);
assert_string(expected, actual.to_string());
}
private void assert_address(Geary.RFC822.MailboxAddress? address,
string expected)
- throws Error {
+ throws GLib.Error {
assert_non_null(address, expected);
assert_string(expected, address.to_rfc822_string());
}
private void assert_addresses(Geary.RFC822.MailboxAddresses? addresses,
string expected)
- throws Error {
+ throws GLib.Error {
assert_non_null(addresses, expected);
assert_string(expected, addresses.to_rfc822_string());
}
@@ -422,7 +422,7 @@ This is the second line.
private void assert_addresses_list(Gee.List<RFC822.MailboxAddress>? addresses,
Gee.List<string> expected,
string context)
- throws Error {
+ throws GLib.Error {
assert_non_null(addresses, context + " not null");
assert_true(addresses.size == expected.size, context + " size");
foreach (RFC822.MailboxAddress address in addresses) {
diff --git a/test/engine/rfc822/rfc822-part-test.vala b/test/engine/rfc822/rfc822-part-test.vala
index 9ec2cabfe..933d15053 100644
--- a/test/engine/rfc822/rfc822-part-test.vala
+++ b/test/engine/rfc822/rfc822-part-test.vala
@@ -23,7 +23,7 @@ class Geary.RFC822.PartTest : TestCase {
add_test("write_to_buffer_plain_utf8", write_to_buffer_plain_utf8);
}
- public void new_from_minimal_mime_part() throws Error {
+ public void new_from_minimal_mime_part() throws GLib.Error {
Part test = new Part(new_part("test/plain", CR_BODY.data));
assert_null_string(test.content_id, "content_id");
@@ -31,7 +31,7 @@ class Geary.RFC822.PartTest : TestCase {
assert_null(test.content_disposition, "content_disposition");
}
- public void new_from_complete_mime_part() throws Error {
+ public void new_from_complete_mime_part() throws GLib.Error {
const string TYPE = "text/plain";
const string ID = "test-id";
const string DESC = "test description";
@@ -58,7 +58,7 @@ class Geary.RFC822.PartTest : TestCase {
);
}
- public void write_to_buffer_plain() throws Error {
+ public void write_to_buffer_plain() throws GLib.Error {
Part test = new Part(new_part("text/plain", CR_BODY.data));
Memory.Buffer buf = test.write_to_buffer(Part.EncodingConversion.NONE);
@@ -66,7 +66,7 @@ class Geary.RFC822.PartTest : TestCase {
assert_string(CR_BODY, buf.to_string());
}
- public void write_to_buffer_plain_crlf() throws Error {
+ public void write_to_buffer_plain_crlf() throws GLib.Error {
Part test = new Part(new_part("text/plain", CRLF_BODY.data));
Memory.Buffer buf = test.write_to_buffer(Part.EncodingConversion.NONE);
@@ -75,7 +75,7 @@ class Geary.RFC822.PartTest : TestCase {
assert_string(CR_BODY, buf.to_string());
}
- public void write_to_buffer_plain_ical() throws Error {
+ public void write_to_buffer_plain_ical() throws GLib.Error {
Part test = new Part(new_part("text/calendar", ICAL_BODY.data));
Memory.Buffer buf = test.write_to_buffer(Part.EncodingConversion.NONE);
diff --git a/test/engine/rfc822/rfc822-utils-test.vala b/test/engine/rfc822/rfc822-utils-test.vala
index 1691fa41e..7711fa9ab 100644
--- a/test/engine/rfc822/rfc822-utils-test.vala
+++ b/test/engine/rfc822/rfc822-utils-test.vala
@@ -15,7 +15,7 @@ class Geary.RFC822.Utils.Test : TestCase {
add_test("best_encoding_binary", best_encoding_binary);
}
- public void to_preview_text() throws Error {
+ public void to_preview_text() throws GLib.Error {
assert(Geary.RFC822.Utils.to_preview_text(PLAIN_BODY_ENCODED, Geary.RFC822.TextFormat.PLAIN) ==
PLAIN_BODY_EXPECTED);
assert(Geary.RFC822.Utils.to_preview_text(HTML_BODY_ENCODED, Geary.RFC822.TextFormat.HTML) ==
diff --git a/test/integration/smtp/client-session.vala b/test/integration/smtp/client-session.vala
index 33ee89d02..3d81a5db4 100644
--- a/test/integration/smtp/client-session.vala
+++ b/test/integration/smtp/client-session.vala
@@ -119,7 +119,7 @@ class Integration.Smtp.ClientSession : TestCase {
private async Geary.RFC822.Message new_message(Geary.RFC822.MailboxAddress from,
Geary.RFC822.MailboxAddress to)
- throws Geary.RFC822Error {
+ throws Geary.RFC822.Error {
Geary.ComposedEmail composed = new Geary.ComposedEmail(
new GLib.DateTime.now_local(),
new Geary.RFC822.MailboxAddresses.single(from)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]