Skip to content

Commit c3e7ddb

Browse files
author
MateuszM
committed
Changed behaviour of mbed_asert to use mbed_error instead of mbed_die.
1 parent a0a9b54 commit c3e7ddb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

platform/mbed_assert.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,21 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
17+
#include <string.h>
1618
#include "platform/mbed_assert.h"
17-
#include "device.h"
1819

19-
#include "platform/mbed_interface.h"
2020
#include "platform/mbed_critical.h"
21+
#include "platform/mbed_error.h"
2122

2223
void mbed_assert_internal(const char *expr, const char *file, int line)
2324
{
2425
core_util_critical_section_enter();
25-
mbed_error_printf("mbed assertation failed: %s, file: %s, line %d \n", expr, file, line);
26-
mbed_die();
26+
27+
const char error_description[] = "Mbed assertation failed ";
28+
unsigned error_message_length = strlen(error_description) + strlen(expr) + 1;
29+
char error_message[error_message_length];
30+
snprintf(error_message, error_message_length, "%s%s", error_description, expr);
31+
32+
mbed_error(MBED_ERROR_INVALID_ARGUMENT, error_message, 0, file, line);
2733
}

0 commit comments

Comments
 (0)