Project

General

Profile

Feature #38273 » 1-missing_container_error.patch

Felix Schäfer, 2023-02-13 15:40

View differences:

app/models/mail_handler.rb
172 172
  rescue MissingInformation => e
173 173
    logger&.error "MailHandler: missing information from #{user}: #{e.message}"
174 174
    false
175
  rescue MissingContainer => e
176
    logger&.error "MailHandler: reply to nonexistant object from #{user}: #{e.message}"
177
    false
175 178
  rescue UnauthorizedAction => e
176 179
    logger&.error "MailHandler: unauthorized attempt from #{user}: #{e.message}"
177 180
    false
......
225 228
  def receive_issue_reply(issue_id, from_journal=nil)
226 229
    issue = Issue.find_by(:id => issue_id)
227 230
    if issue.nil?
228
      logger&.info "MailHandler: ignoring reply from [#{email.from.first}] to a nonexistent issue"
229
      return nil
231
      raise MissingContainer, "reply to nonexistant issue [##{issue_id}]"
230 232
    end
231 233

  
232 234
    # Never receive emails to projects where adding issue notes is not possible
......
270 272
      logger&.info "MailHandler: reply to a nonexistant journal, calling receive_issue_reply with issue from subject"
271 273
      receive_issue_reply(m[1].to_i)
272 274
    else
273
      logger&.info "MailHandler: ignoring reply to a nonexistant journal or issue"
274
      return nil
275
      raise MissingContainer, "reply to nonexistant journal [#{journal_id}]"
275 276
    end
276 277
  end
277 278

  
......
279 280
  def receive_message_reply(message_id)
280 281
    message = Message.find_by(:id => message_id)&.root
281 282
    if message.nil?
282
      logger&.info "MailHandler: ignoring reply from [#{email.from.first}] to a nonexistent message"
283
      return nil
283
      raise MissingContainer, "reply to nonexistant message [#{message_id}]"
284 284
    end
285 285

  
286 286
    # Never receive emails to projects where adding messages is not possible
(1-1/2)