Skip to content

Commit 08a3b06

Browse files
committed
lowered logging level for swallowed exception
1 parent fb0f9b7 commit 08a3b06

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

Rubberduck.VBEditor.VB6/SafeComWrappers/VB/CodeModule.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ public void InsertLines(int line, string content)
128128
}
129129
catch (Exception e)
130130
{
131-
_logger.Error(e);
131+
// "too many line continuations" is one possible cause for a COMException here.
132+
// deleting the only line in a module is another.
133+
// we can log the exception, but really we're just intentionally swallowing it.
134+
_logger.Warn(e, $"{nameof(InsertLines)} failed.");
132135
}
133136
}
134137

@@ -142,7 +145,10 @@ public void DeleteLines(int startLine, int count = 1)
142145
}
143146
catch (Exception e)
144147
{
145-
_logger.Error(e);
148+
// "too many line continuations" is one possible cause for a COMException here.
149+
// deleting the only line in a module is another.
150+
// we can log the exception, but really we're just intentionally swallowing it.
151+
_logger.Warn(e, $"{nameof(DeleteLines)} failed.");
146152
}
147153
}
148154

@@ -160,7 +166,10 @@ public void ReplaceLine(int line, string content)
160166
}
161167
catch (Exception e)
162168
{
163-
_logger.Error(e);
169+
// "too many line continuations" is one possible cause for a COMException here.
170+
// deleting the only line in a module is another.
171+
// we can log the exception, but really we're just intentionally swallowing it.
172+
_logger.Warn(e, $"{nameof(ReplaceLine)} failed.");
164173
}
165174
}
166175

Rubberduck.VBEditor.VBA/SafeComWrappers/VB/CodeModule.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ public void InsertLines(int line, string content)
129129
catch (Exception e)
130130
{
131131
// "too many line continuations" is one possible cause for a COMException here.
132-
_logger.Error(e);
133-
throw;
132+
// deleting the only line in a module is another.
133+
// we can log the exception, but really we're just intentionally swallowing it.
134+
_logger.Warn(e, $"{nameof(InsertLines)} failed.");
134135
}
135136
}
136137

@@ -148,8 +149,9 @@ public void DeleteLines(int startLine, int count = 1)
148149
catch (Exception e)
149150
{
150151
// "too many line continuations" is one possible cause for a COMException here.
151-
_logger.Error(e);
152-
throw;
152+
// deleting the only line in a module is another.
153+
// we can log the exception, but really we're just intentionally swallowing it.
154+
_logger.Warn(e, $"{nameof(DeleteLines)} failed.");
153155
}
154156
}
155157
}
@@ -176,8 +178,9 @@ public void ReplaceLine(int line, string content)
176178
catch (Exception e)
177179
{
178180
// "too many line continuations" is one possible cause for a COMException here.
179-
_logger.Error(e);
180-
throw;
181+
// deleting the only line in a module is another.
182+
// we can log the exception, but really we're just intentionally swallowing it.
183+
_logger.Warn(e, $"{nameof(ReplaceLine)} failed.");
181184
}
182185
}
183186

0 commit comments

Comments
 (0)