Project

General

Profile

Feedback #9866

When iterating through PartModules, each call should be wrapped in a try/catch block

Added by blowfish almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Severity:
Low
Assignee:
-
Category:
Plugins/Add-Ons
Target version:
-
Version:
Platform:
Windows
Expansion:
Language:
English (US)
Mod Related:
No
Votes:
Arrow u r green
Arrow d r red

Description

Methods like OnStart(), OnUpdate(), OnFixedUpdate() are called by iterating through PartModules. But if one PartModule throws an exception (which is pretty common in mods), then it will cause the method to not be called on any other module, and possibly some of KSP's own code to not execute too (basically up to the last method that was called by Unity directly). If each call where wrapped in a try/catch, it would at least prevent odd coupling issues where one bad module causes several other things to break. I'd recommend doing this for all of PartModule's virtual methods.

History

#1 Updated by TriggerAu almost 8 years ago

  • Status changed from New to Needs Clarification

#3 Updated by blowfish almost 8 years ago

  • Status changed from Needs Clarification to Closed
  • % Done changed from 0 to 100

Movving to Modders' Corner and closing

Also available in: Atom PDF