In a surgical power tool that includes an electric motor positioned in a housing and a movable element extending from the housing and operatively actuated by the electric motor, a controller can repeatedly interrogate for faults a plurality of components in or on the housing, such as the electric motor, the controller, a battery, a trigger, and a mode switch. Upon finding a component in a fault condition, the controller can engage a critical error handler that disengages the electric motor, disables at least some of the plurality of components, and directs a microprocessor in the controller into a safe software state. Upon engaging the critical error handler, the controller can further write to a memory an error code corresponding to which of the plurality of components is in the fault condition. The error code can be accessible via a wired or wireless connection.